зеркало из https://github.com/mozilla/pjs.git
Sprinkled SizeOf methods around
This commit is contained in:
Родитель
eb9da95f49
Коммит
71d12dae58
|
@ -25,7 +25,7 @@ class nsIAtom;
|
|||
class nsIContentDelegate;
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsISizeofHandler;
|
||||
class nsISizeOfHandler;
|
||||
class nsString;
|
||||
class nsString;
|
||||
class nsVoidArray;
|
||||
|
@ -124,10 +124,10 @@ public:
|
|||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
/**
|
||||
* Return the number of bytes consumed by this node of content and
|
||||
* anything that it can reach.
|
||||
* Add this object's size information to the sizeof handler and
|
||||
* any objects that it can reach.
|
||||
*/
|
||||
virtual PRUint32 SizeOf(nsISizeofHandler* aHandler) const = 0;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIContent_h___ */
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIStyleContext.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLAttributesIID, NS_IHTML_ATTRIBUTES_IID);
|
||||
static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
|
@ -60,6 +61,8 @@ struct HTMLAttribute {
|
|||
NS_IF_RELEASE(mAttribute);
|
||||
}
|
||||
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
HTMLAttribute& operator=(const HTMLAttribute& aCopy)
|
||||
{
|
||||
NS_IF_RELEASE(mAttribute);
|
||||
|
@ -117,6 +120,16 @@ struct HTMLAttribute {
|
|||
HTMLAttribute* mNext;
|
||||
};
|
||||
|
||||
void
|
||||
HTMLAttribute::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX mAttribute
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (!aHandler->HaveSeen(mNext)) {
|
||||
mNext->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------
|
||||
|
||||
|
||||
|
@ -152,6 +165,11 @@ public:
|
|||
|
||||
virtual void MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
private:
|
||||
|
@ -524,6 +542,17 @@ void HTMLAttributesImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext*
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLAttributesImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mID
|
||||
// XXX mClass
|
||||
if (!aHandler->HaveSeen(mFirst)) {
|
||||
mFirst->SizeOf(aHandler);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsIContent.h"
|
||||
class nsIAtom;
|
||||
class nsISizeOfHandler;
|
||||
class nsISupportsArray;
|
||||
class nsIHTMLContent;
|
||||
|
||||
|
@ -49,6 +50,11 @@ public:
|
|||
virtual PRInt32 SetClass(nsIAtom* aClass) = 0; // XXX this will have to change for CSS2
|
||||
virtual nsIAtom* GetClass(void) const = 0; // XXX this will have to change for CSS2
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class nsIAtom;
|
|||
class nsIContentDelegate;
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsISizeofHandler;
|
||||
class nsISizeOfHandler;
|
||||
class nsString;
|
||||
class nsString;
|
||||
class nsVoidArray;
|
||||
|
@ -124,10 +124,10 @@ public:
|
|||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
/**
|
||||
* Return the number of bytes consumed by this node of content and
|
||||
* anything that it can reach.
|
||||
* Add this object's size information to the sizeof handler and
|
||||
* any objects that it can reach.
|
||||
*/
|
||||
virtual PRUint32 SizeOf(nsISizeofHandler* aHandler) const = 0;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIContent_h___ */
|
||||
|
|
|
@ -26,14 +26,15 @@
|
|||
#include "nsStyleStruct.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIRenderingContext;
|
||||
class nsISizeOfHandler;
|
||||
class nsISpaceManager;
|
||||
class nsIStyleContext;
|
||||
class nsIView;
|
||||
class nsIWidget;
|
||||
class nsIFrame;
|
||||
class nsReflowCommand;
|
||||
|
||||
struct nsPoint;
|
||||
|
@ -217,6 +218,13 @@ public:
|
|||
*/
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr) = 0;
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler. Note that
|
||||
* this does <b>not</b> add in the size of content, style, or view's
|
||||
* (those are sized seperately).
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
|
||||
/**
|
||||
* Deletes this frame and each of its child frames (recursively calls
|
||||
* DeleteFrame() for each child)
|
||||
|
|
|
@ -24,6 +24,7 @@ class nsIFrame;
|
|||
class nsIImage;
|
||||
class nsIImageGroup;
|
||||
class nsIPresContext;
|
||||
class nsISizeOfHandler;
|
||||
class nsString;
|
||||
struct nsSize;
|
||||
|
||||
|
@ -58,6 +59,8 @@ public:
|
|||
NS_IMETHOD GetSize(nsSize& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetImageLoadStatus(PRIntn& aLoadStatus) const = 0;
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
};
|
||||
|
||||
// Image load status bit values
|
||||
|
|
|
@ -31,7 +31,7 @@ CPPSRCS = \
|
|||
nsPresShell.cpp \
|
||||
nsPrintPreviewContext.cpp \
|
||||
nsReflowCommand.cpp \
|
||||
nsSelection.cpp \
|
||||
nsSelection.cpp \
|
||||
nsSelectionPoint.cpp \
|
||||
nsSelectionRange.cpp \
|
||||
nsSpaceManager.cpp \
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#undef NOISY
|
||||
|
@ -58,6 +59,24 @@ nsContainerFrame::~nsContainerFrame()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsContainerFrame::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
nsSplittableFrame::SizeOfWithoutThis(aHandler);
|
||||
for (nsIFrame* child = mFirstChild; child; ) {
|
||||
child->SizeOf(aHandler);
|
||||
child->GetNextSibling(child);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::PrepareContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent,
|
||||
|
|
|
@ -105,6 +105,8 @@
|
|||
class nsContainerFrame : public nsSplittableFrame
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
/**
|
||||
* Default implementation is to use the content delegate to create a new
|
||||
* frame. After the frame is created it uses PrepareContinuingFrame() to
|
||||
|
@ -197,6 +199,8 @@ protected:
|
|||
|
||||
virtual ~nsContainerFrame();
|
||||
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
/**
|
||||
* Prepare a continuation frame of this frame for reflow. Appends
|
||||
* it to the flow, sets its content offsets, mLastContentIsComplete,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "prprf.h"
|
||||
#include <stdarg.h>
|
||||
#include "nsIPtr.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#define DO_SELECTION 0
|
||||
|
||||
|
@ -250,6 +251,24 @@ NS_METHOD nsFrame::DeleteFrame()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// Note: style context's are accounted for via the style system's
|
||||
// sizeof support
|
||||
|
||||
// Note: content is accounted for via the content system's sizeof
|
||||
// support
|
||||
}
|
||||
|
||||
NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const
|
||||
{
|
||||
if (nsnull != mContent) {
|
||||
|
|
|
@ -77,40 +77,33 @@ public:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParent);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// Overloaded new operator. Initializes the memory to 0
|
||||
void* operator new(size_t size);
|
||||
|
||||
NS_IMETHOD DeleteFrame();
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame();
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
NS_IMETHOD GetContent(nsIContent*& aContent) const;
|
||||
NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const;
|
||||
|
||||
NS_IMETHOD GetStyleContext(nsIPresContext* aContext, nsIStyleContext*& aStyleContext);
|
||||
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aContext);
|
||||
|
||||
// Get the style struct associated with this frame
|
||||
NS_IMETHOD GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const;
|
||||
|
||||
|
||||
// Geometric and content parent
|
||||
NS_IMETHOD GetStyleContext(nsIPresContext* aContext,
|
||||
nsIStyleContext*& aStyleContext);
|
||||
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aContext);
|
||||
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
|
||||
const nsStyleStruct*& aStyleStruct) const;
|
||||
NS_IMETHOD GetContentParent(nsIFrame*& aParent) const;
|
||||
NS_IMETHOD SetContentParent(const nsIFrame* aParent);
|
||||
NS_IMETHOD GetGeometricParent(nsIFrame*& aParent) const;
|
||||
NS_IMETHOD SetGeometricParent(const nsIFrame* aParent);
|
||||
|
||||
// Bounding rect
|
||||
NS_IMETHOD GetRect(nsRect& aRect) const;
|
||||
NS_IMETHOD GetOrigin(nsPoint& aPoint) const;
|
||||
NS_IMETHOD GetSize(nsSize& aSize) const;
|
||||
NS_IMETHOD SetRect(const nsRect& aRect);
|
||||
NS_IMETHOD MoveTo(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight);
|
||||
|
||||
// Child frame enumeration
|
||||
NS_IMETHOD ChildCount(PRInt32& aChildCount) const;
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIFrame*& aFrame) const;
|
||||
NS_IMETHOD IndexOf(const nsIFrame* aChild, PRInt32& aIndex) const;
|
||||
|
@ -118,7 +111,6 @@ public:
|
|||
NS_IMETHOD NextChild(const nsIFrame* aChild, nsIFrame*& aNextChild) const;
|
||||
NS_IMETHOD PrevChild(const nsIFrame* aChild, nsIFrame*& aPrevChild) const;
|
||||
NS_IMETHOD LastChild(nsIFrame*& aLastChild) const;
|
||||
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
@ -129,11 +121,8 @@ public:
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame,
|
||||
PRInt32& aCursor);
|
||||
|
||||
NS_IMETHOD GetFrameState(nsFrameState& aResult);
|
||||
NS_IMETHOD SetFrameState(nsFrameState aNewState);
|
||||
|
||||
// Reflow methods
|
||||
NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
@ -168,60 +157,41 @@ public:
|
|||
nsISupports* aSubContent);
|
||||
NS_IMETHOD GetReflowMetrics(nsIPresContext* aPresContext,
|
||||
nsReflowMetrics& aMetrics);
|
||||
|
||||
// Flow member functions
|
||||
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aContinuingFrame);
|
||||
|
||||
NS_IMETHOD GetPrevInFlow(nsIFrame*& aPrevInFlow) const;
|
||||
NS_IMETHOD SetPrevInFlow(nsIFrame*);
|
||||
NS_IMETHOD GetNextInFlow(nsIFrame*& aNextInFlow) const;
|
||||
NS_IMETHOD SetNextInFlow(nsIFrame*);
|
||||
|
||||
NS_IMETHOD AppendToFlow(nsIFrame* aAfterFrame);
|
||||
NS_IMETHOD PrependToFlow(nsIFrame* aAfterFrame);
|
||||
NS_IMETHOD RemoveFromFlow();
|
||||
NS_IMETHOD BreakFromPrevFlow();
|
||||
NS_IMETHOD BreakFromNextFlow();
|
||||
|
||||
// Associated view object
|
||||
NS_IMETHOD GetView(nsIView*& aView) const;
|
||||
NS_IMETHOD SetView(nsIView* aView);
|
||||
|
||||
// Find the first geometric parent that has a view
|
||||
NS_IMETHOD GetParentWithView(nsIFrame*& aParent) const;
|
||||
|
||||
// Returns the offset from this frame to the closest geometric parent that
|
||||
// has a view. Also returns the containing view, or null in case of error
|
||||
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const;
|
||||
|
||||
// Returns the closest geometric parent that has a view which has a
|
||||
// a window.
|
||||
NS_IMETHOD GetWindow(nsIWidget*&) const;
|
||||
|
||||
// Style sizing methods
|
||||
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
|
||||
NS_IMETHOD GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const;
|
||||
|
||||
// Sibling pointer used to link together frames
|
||||
NS_IMETHOD GetNextSibling(nsIFrame*& aNextSibling) const;
|
||||
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling);
|
||||
NS_IMETHOD IsTransparent(PRBool& aTransparent) const;
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
NS_IMETHOD ListTag(FILE* out = stdout) const;
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
// Transparency query
|
||||
NS_IMETHOD IsTransparent(PRBool& aTransparent) const;
|
||||
//--------------------------------------------------
|
||||
// Additional methods
|
||||
|
||||
// Invalidate part of the frame by asking the view manager to repaint.
|
||||
// aDamageRect is in the frame's local coordinate space
|
||||
void Invalidate(const nsRect& aDamageRect) const;
|
||||
|
||||
// Debugging
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
NS_IMETHOD ListTag(FILE* out = stdout) const;
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Tracing method that writes a method enter/exit routine to the
|
||||
|
@ -286,6 +256,8 @@ protected:
|
|||
|
||||
virtual ~nsFrame();
|
||||
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsRect mRect;
|
||||
nsIContent* mContent;
|
||||
nsIStyleContext* mStyleContext;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsIImageRequest.h"
|
||||
#include "nsString.h"
|
||||
#include "prlog.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIFrameImageLoaderIID, NS_IFRAME_IMAGE_LOADER_IID);
|
||||
static NS_DEFINE_IID(kIImageRequestObserverIID, NS_IIMAGEREQUESTOBSERVER_IID);
|
||||
|
@ -306,3 +307,12 @@ nsFrameImageLoader::GetImageLoadStatus(PRIntn& aLoadStatus) const
|
|||
aLoadStatus = mImageLoadStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameImageLoader::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mImage
|
||||
// XXX mImageRequest
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
NS_IMETHOD GetImage(nsIImage*& aResult) const;
|
||||
NS_IMETHOD GetSize(nsSize& aResult) const;
|
||||
NS_IMETHOD GetImageLoadStatus(PRIntn& aLoadStatus) const;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsFrameImageLoader();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsIContentDelegate.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
nsSplittableFrame::nsSplittableFrame(nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
|
@ -29,12 +30,32 @@ nsSplittableFrame::nsSplittableFrame(nsIContent* aContent,
|
|||
|
||||
nsSplittableFrame::~nsSplittableFrame()
|
||||
{
|
||||
// XXX write me
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSplittableFrame::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsSplittableFrame::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsSplittableFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
nsFrame::SizeOfWithoutThis(aHandler);
|
||||
if (!aHandler->HaveSeen(mPrevInFlow)) {
|
||||
mPrevInFlow->SizeOf(aHandler);
|
||||
}
|
||||
if (!aHandler->HaveSeen(mNextInFlow)) {
|
||||
mNextInFlow->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
// Flow member functions
|
||||
|
||||
NS_METHOD nsSplittableFrame::IsSplittable(nsSplittableType& aIsSplittable) const
|
||||
NS_IMETHODIMP
|
||||
nsSplittableFrame::IsSplittable(nsSplittableType& aIsSplittable) const
|
||||
{
|
||||
aIsSplittable = NS_FRAME_SPLITTABLE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
class nsSplittableFrame : public nsFrame
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
// CreateContinuingFrame() does the default behavior of using the
|
||||
// content delegate to create a new frame
|
||||
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
|
||||
|
@ -65,6 +66,8 @@ protected:
|
|||
|
||||
virtual ~nsSplittableFrame();
|
||||
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsIFrame* mPrevInFlow;
|
||||
nsIFrame* mNextInFlow;
|
||||
};
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
nsIContentDelegate* GetDelegate(nsIPresContext* aCX) {return nsnull;}
|
||||
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const {;}
|
||||
PRUint32 SizeOf(nsISizeofHandler* aHandler) const { return 0; }
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const { return NS_OK; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
|
|
@ -26,14 +26,15 @@
|
|||
#include "nsStyleStruct.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIRenderingContext;
|
||||
class nsISizeOfHandler;
|
||||
class nsISpaceManager;
|
||||
class nsIStyleContext;
|
||||
class nsIView;
|
||||
class nsIWidget;
|
||||
class nsIFrame;
|
||||
class nsReflowCommand;
|
||||
|
||||
struct nsPoint;
|
||||
|
@ -217,6 +218,13 @@ public:
|
|||
*/
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr) = 0;
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler. Note that
|
||||
* this does <b>not</b> add in the size of content, style, or view's
|
||||
* (those are sized seperately).
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
|
||||
/**
|
||||
* Deletes this frame and each of its child frames (recursively calls
|
||||
* DeleteFrame() for each child)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#undef SCALE
|
||||
#define SCALE(a,b) nscoord((a) * (b))
|
||||
|
@ -48,6 +49,8 @@ public:
|
|||
const nsString& GetAltText() const { return mAltText; }
|
||||
PRBool GetSuppress() const { return mSuppressFeedback; }
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsString mBase;
|
||||
nsString mHREF;
|
||||
nsString mTarget;
|
||||
|
@ -72,6 +75,14 @@ Area::~Area()
|
|||
delete [] mCoords;
|
||||
}
|
||||
|
||||
void
|
||||
Area::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mBase, mHREF, mTarget, mAltText
|
||||
aHandler->Add(mNumCoords * sizeof(nscoord));
|
||||
}
|
||||
|
||||
// XXX move into nsCRT
|
||||
#define XP_IS_SPACE(_ch) \
|
||||
(((_ch) == ' ') || ((_ch) == '\t') || ((_ch) == '\r') || ((_ch) == '\n'))
|
||||
|
@ -592,6 +603,8 @@ public:
|
|||
|
||||
NS_IMETHOD Draw(nsIPresContext& aCX, nsIRenderingContext& aRC);
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsString mName;
|
||||
nsIAtom* mTag;
|
||||
nsVoidArray mAreas;
|
||||
|
@ -695,6 +708,21 @@ NS_IMETHODIMP ImageMapImpl::Draw(nsIPresContext& aCX, nsIRenderingContext& aRC)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageMapImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mName
|
||||
// XXX mTag
|
||||
// XXX mAreas array slots
|
||||
PRInt32 i, n = mAreas.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = (Area*) mAreas[i];
|
||||
area->SizeOf(aHandler);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_HTML nsresult NS_NewImageMap(nsIImageMap** aInstancePtrResult,
|
||||
nsIAtom* aTag)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsUnitConversion.h"
|
||||
#include "nsIURL.h"
|
||||
#include "prprf.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLContainer(nsIHTMLContent** aInstancePtrResult,
|
||||
|
@ -73,6 +74,28 @@ nsHTMLContainer::~nsHTMLContainer()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContainer::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsHTMLContainer::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainer::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX children array's array of pointers
|
||||
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIContent* child = (nsIContent*) mChildren[i];
|
||||
if (!aHandler->HaveSeen(child)) {
|
||||
child->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsHTMLContainer::CanContainChildren() const
|
||||
{
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -27,6 +27,7 @@ class nsHTMLContainer : public nsHTMLTagContent {
|
|||
public:
|
||||
nsHTMLContainer(nsIAtom* aTag);
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
virtual PRBool CanContainChildren() const;
|
||||
virtual PRInt32 ChildCount() const;
|
||||
virtual nsIContent* ChildAt(PRInt32 aIndex) const;
|
||||
|
@ -59,6 +60,7 @@ public:
|
|||
protected:
|
||||
nsHTMLContainer();
|
||||
virtual ~nsHTMLContainer();
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual nsContentAttr AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIContentDelegateIID, NS_ICONTENTDELEGATE_IID);
|
||||
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
|
||||
|
@ -393,9 +394,18 @@ void nsHTMLContent::List(FILE* out, PRInt32 aIndent) const
|
|||
fputs(">\n", out);
|
||||
}
|
||||
|
||||
PRUint32 nsHTMLContent::SizeOf(nsISizeofHandler* aHandler) const
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContent::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
return 0;
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsHTMLContent::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContent::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX mScriptObject
|
||||
}
|
||||
|
||||
nsIAtom* nsHTMLContent::GetTag() const
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
virtual void List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
virtual PRUint32 SizeOf(nsISizeofHandler* aHandler) const;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual nsIAtom* GetTag() const;
|
||||
|
||||
|
@ -130,6 +130,7 @@ protected:
|
|||
nsHTMLContent();
|
||||
virtual ~nsHTMLContent();
|
||||
virtual void ListAttributes(FILE* out) const;
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
PRUint32 mInHeap : 1;
|
||||
PRUint32 mRefCnt : 31;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsCSSLayout.h"
|
||||
#include "nsHTMLFrame.h"
|
||||
#include "prprf.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#define BROKEN_IMAGE_URL "resource:/res/html/broken-image.gif"
|
||||
|
||||
|
@ -47,10 +48,12 @@
|
|||
|
||||
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
|
||||
class ImagePart : public nsHTMLTagContent {
|
||||
#define nsHTMLImageSuper nsHTMLTagContent
|
||||
class nsHTMLImage : public nsHTMLImageSuper {
|
||||
public:
|
||||
ImagePart(nsIAtom* aTag);
|
||||
nsHTMLImage(nsIAtom* aTag);
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
virtual nsresult CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
|
@ -81,38 +84,39 @@ public:
|
|||
nsString* mUseMap;
|
||||
|
||||
protected:
|
||||
virtual ~ImagePart();
|
||||
virtual ~nsHTMLImage();
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual nsContentAttr AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const;
|
||||
};
|
||||
|
||||
class ImageFrame : public nsLeafFrame {
|
||||
#define ImageFrameSuper nsLeafFrame
|
||||
class ImageFrame : public ImageFrameSuper {
|
||||
public:
|
||||
ImageFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
NS_IMETHOD DeleteFrame();
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
NS_METHOD HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
||||
NS_IMETHOD GetCursorAt(nsIPresContext& aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame,
|
||||
PRInt32& aCursor);
|
||||
|
||||
PRBool IsServerImageMap() {
|
||||
return ((ImagePart*)mContent)->IsMap();
|
||||
return ((nsHTMLImage*)mContent)->IsMap();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ImageFrame();
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
|
@ -156,6 +160,18 @@ nsHTMLImageLoader::~nsHTMLImageLoader()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLImageLoader::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (!aHandler->HaveSeen(mURLSpec)) {
|
||||
aHandler->Add(sizeof(*mURLSpec));/* XXX approximation */
|
||||
}
|
||||
if (!aHandler->HaveSeen(mImageLoader)) {
|
||||
mImageLoader->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
nsIImage*
|
||||
nsHTMLImageLoader::GetImage()
|
||||
{
|
||||
|
@ -333,6 +349,24 @@ ImageFrame::DeleteFrame()
|
|||
return nsLeafFrame::DeleteFrame();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageFrame::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
ImageFrame::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ImageFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
ImageFrameSuper::SizeOfWithoutThis(aHandler);
|
||||
mImageLoader.SizeOf(aHandler);
|
||||
if (!aHandler->HaveSeen(mImageMap)) {
|
||||
mImageMap->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ImageFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
|
@ -402,7 +436,7 @@ nsIImageMap*
|
|||
ImageFrame::GetImageMap()
|
||||
{
|
||||
if (nsnull == mImageMap) {
|
||||
ImagePart* part = (ImagePart*)mContent;
|
||||
nsHTMLImage* part = (nsHTMLImage*)mContent;
|
||||
if (nsnull == part->mUseMap) {
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -493,10 +527,10 @@ ImageFrame::HandleEvent(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
else {
|
||||
suppress = ((ImagePart*)mContent)->GetSuppress();
|
||||
suppress = ((nsHTMLImage*)mContent)->GetSuppress();
|
||||
nsAutoString baseURL;/* XXX */
|
||||
nsAutoString src;
|
||||
nsString* srcp = ((ImagePart*)mContent)->mSrc;
|
||||
nsString* srcp = ((nsHTMLImage*)mContent)->mSrc;
|
||||
if (nsnull != srcp) {
|
||||
src.Append(*srcp);
|
||||
}
|
||||
|
@ -553,14 +587,14 @@ ImageFrame::GetCursorAt(nsIPresContext& aPresContext,
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ImagePart::ImagePart(nsIAtom* aTag)
|
||||
nsHTMLImage::nsHTMLImage(nsIAtom* aTag)
|
||||
: nsHTMLTagContent(aTag)
|
||||
{
|
||||
mAlign = ALIGN_UNSET;
|
||||
mSuppress = SUPPRESS_UNSET;
|
||||
}
|
||||
|
||||
ImagePart::~ImagePart()
|
||||
nsHTMLImage::~nsHTMLImage()
|
||||
{
|
||||
if (nsnull != mAltText) delete mAltText;
|
||||
if (nsnull != mSrc) delete mSrc;
|
||||
|
@ -568,7 +602,20 @@ ImagePart::~ImagePart()
|
|||
if (nsnull != mUseMap) delete mUseMap;
|
||||
}
|
||||
|
||||
void ImagePart::SetAttribute(nsIAtom* aAttribute, const nsString& aString)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLImage::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsHTMLImage::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLImage::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
}
|
||||
|
||||
void nsHTMLImage::SetAttribute(nsIAtom* aAttribute, const nsString& aString)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::ismap) {
|
||||
mIsMap = PR_TRUE;
|
||||
|
@ -645,8 +692,8 @@ void ImagePart::SetAttribute(nsIAtom* aAttribute, const nsString& aString)
|
|||
nsHTMLTagContent::SetAttribute(aAttribute, aString);
|
||||
}
|
||||
|
||||
nsContentAttr ImagePart::GetAttribute(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aResult) const
|
||||
nsContentAttr nsHTMLImage::GetAttribute(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aResult) const
|
||||
{
|
||||
nsContentAttr ca = eContentAttr_NotThere;
|
||||
aResult.Reset();
|
||||
|
@ -701,7 +748,7 @@ nsContentAttr ImagePart::GetAttribute(nsIAtom* aAttribute,
|
|||
return ca;
|
||||
}
|
||||
|
||||
void ImagePart::UnsetAttribute(nsIAtom* aAttribute)
|
||||
void nsHTMLImage::UnsetAttribute(nsIAtom* aAttribute)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::ismap) {
|
||||
mIsMap = PR_FALSE;
|
||||
|
@ -741,9 +788,9 @@ void ImagePart::UnsetAttribute(nsIAtom* aAttribute)
|
|||
}
|
||||
}
|
||||
|
||||
nsContentAttr ImagePart::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
nsContentAttr nsHTMLImage::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
nsContentAttr ca = eContentAttr_NotThere;
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
|
@ -770,8 +817,8 @@ nsContentAttr ImagePart::AttributeToString(nsIAtom* aAttribute,
|
|||
return ca;
|
||||
}
|
||||
|
||||
void ImagePart::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
void nsHTMLImage::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (ALIGN_UNSET != mAlign) {
|
||||
nsStyleDisplay* display = (nsStyleDisplay*)
|
||||
|
@ -795,10 +842,10 @@ void ImagePart::MapAttributesInto(nsIStyleContext* aContext,
|
|||
}
|
||||
|
||||
nsresult
|
||||
ImagePart::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
nsHTMLImage::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
ImageFrame* frame = new ImageFrame(this, aParentFrame);
|
||||
if (nsnull == frame) {
|
||||
|
@ -817,7 +864,7 @@ NS_NewHTMLImage(nsIHTMLContent** aInstancePtrResult,
|
|||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* img = new ImagePart(aTag);
|
||||
nsIHTMLContent* img = new nsHTMLImage(aTag);
|
||||
if (nsnull == img) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
class nsIFrame;
|
||||
class nsIFrameImageLoader;
|
||||
class nsIPresContext;
|
||||
class nsISizeOfHandler;
|
||||
struct nsReflowState;
|
||||
struct nsReflowMetrics;
|
||||
struct nsSize;
|
||||
|
@ -59,6 +60,8 @@ public:
|
|||
return mLoadImageFailed;
|
||||
}
|
||||
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsIFrameImageLoader* mImageLoader;
|
||||
PRPackedBool mLoadImageFailed;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsDOMAttributes.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
|
@ -80,6 +81,23 @@ nsIAtom* nsHTMLTagContent::GetTag() const
|
|||
return mTag;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTagContent::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
nsHTMLTagContent::SizeOfWithoutThis(aHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLTagContent::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX tag
|
||||
if (!aHandler->HaveSeen(mAttributes)) {
|
||||
mAttributes->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
void nsHTMLTagContent::ToHTMLString(nsString& aBuf) const
|
||||
{
|
||||
aBuf.Truncate(0);
|
||||
|
|
|
@ -31,11 +31,12 @@ class nsIStyleContext;
|
|||
*/
|
||||
class nsHTMLTagContent : public nsHTMLContent, public nsIDOMElement {
|
||||
public:
|
||||
/**
|
||||
* Return nsnull if no tag set.
|
||||
*/
|
||||
virtual nsIAtom* GetTag() const;
|
||||
|
||||
// nsIContent
|
||||
virtual nsIAtom* GetTag() const;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
// nsIHTMLContent
|
||||
/**
|
||||
* Translate the content object into it's source html format
|
||||
*/
|
||||
|
@ -190,10 +191,9 @@ public:
|
|||
|
||||
protected:
|
||||
nsHTMLTagContent();
|
||||
|
||||
nsHTMLTagContent(nsIAtom* aTag);
|
||||
|
||||
virtual ~nsHTMLTagContent();
|
||||
void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
/**
|
||||
* Helper method used by GetAttribute to map an attribute
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsIImageMap_h___
|
||||
#define nsIImageMap_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
class nsIAtom;
|
||||
class nsIPresContext;
|
||||
class nsIRenderingContext;
|
||||
class nsIURL;
|
||||
class nsString;
|
||||
|
||||
/* db6ca200-d0a6-11d1-89b1-006008911b81 */
|
||||
#define NS_IIMAGEMAP_IID \
|
||||
{0xdb6ca200, 0xd0a6, 0x11d1, {0x89, 0xb1, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81}}
|
||||
|
||||
class nsIImageMap : public nsISupports {
|
||||
public:
|
||||
NS_IMETHOD SetName(const nsString& aMapName) = 0;
|
||||
|
||||
NS_IMETHOD GetName(nsString& aResult) = 0;
|
||||
|
||||
NS_IMETHOD AddArea(const nsString& aBaseURL,
|
||||
const nsString& aShape,
|
||||
const nsString& aCoords,
|
||||
const nsString& aHREF,
|
||||
const nsString& aTarget,
|
||||
const nsString& aAltText,
|
||||
PRBool aSuppress) = 0;
|
||||
|
||||
/**
|
||||
* See if the given aX,aY <b>pixel</b> coordinates are in the image
|
||||
* map. If they are then NS_OK is returned and aAbsURL, aTarget,
|
||||
* aAltText, aSuppress are filled in with the values from the
|
||||
* underlying area tag. If the coordinates are not in the map
|
||||
* then NS_NOT_INSIDE is returned.
|
||||
*/
|
||||
NS_IMETHOD IsInside(nscoord aX, nscoord aY,
|
||||
nsIURL* aDocURL,
|
||||
nsString& aAbsURL,
|
||||
nsString& aTarget,
|
||||
nsString& aAltText,
|
||||
PRBool* aSuppress) = 0;
|
||||
|
||||
/**
|
||||
* See if the given aX,aY <b>pixel</b> coordinates are in the image
|
||||
* map. If they are then NS_OK is returned otherwise NS_NOT_INSIDE
|
||||
* is returned.
|
||||
*/
|
||||
NS_IMETHOD IsInside(nscoord aX, nscoord aY) = 0;
|
||||
|
||||
NS_IMETHOD Draw(nsIPresContext& aCX, nsIRenderingContext& aRC) = 0;
|
||||
};
|
||||
|
||||
// XXX get an error space to alloc from
|
||||
#define NS_NOT_INSIDE 1
|
||||
|
||||
extern NS_HTML nsresult NS_NewImageMap(nsIImageMap** aInstancePtrResult,
|
||||
nsIAtom* aAtom);
|
||||
|
||||
#endif /* nsIImageMap_h___ */
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
#undef SCALE
|
||||
#define SCALE(a,b) nscoord((a) * (b))
|
||||
|
@ -48,6 +49,8 @@ public:
|
|||
const nsString& GetAltText() const { return mAltText; }
|
||||
PRBool GetSuppress() const { return mSuppressFeedback; }
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsString mBase;
|
||||
nsString mHREF;
|
||||
nsString mTarget;
|
||||
|
@ -72,6 +75,14 @@ Area::~Area()
|
|||
delete [] mCoords;
|
||||
}
|
||||
|
||||
void
|
||||
Area::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mBase, mHREF, mTarget, mAltText
|
||||
aHandler->Add(mNumCoords * sizeof(nscoord));
|
||||
}
|
||||
|
||||
// XXX move into nsCRT
|
||||
#define XP_IS_SPACE(_ch) \
|
||||
(((_ch) == ' ') || ((_ch) == '\t') || ((_ch) == '\r') || ((_ch) == '\n'))
|
||||
|
@ -592,6 +603,8 @@ public:
|
|||
|
||||
NS_IMETHOD Draw(nsIPresContext& aCX, nsIRenderingContext& aRC);
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
nsString mName;
|
||||
nsIAtom* mTag;
|
||||
nsVoidArray mAreas;
|
||||
|
@ -695,6 +708,21 @@ NS_IMETHODIMP ImageMapImpl::Draw(nsIPresContext& aCX, nsIRenderingContext& aRC)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageMapImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mName
|
||||
// XXX mTag
|
||||
// XXX mAreas array slots
|
||||
PRInt32 i, n = mAreas.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = (Area*) mAreas[i];
|
||||
area->SizeOf(aHandler);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_HTML nsresult NS_NewImageMap(nsIImageMap** aInstancePtrResult,
|
||||
nsIAtom* aTag)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIStyleContext.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLAttributesIID, NS_IHTML_ATTRIBUTES_IID);
|
||||
static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
|
@ -60,6 +61,8 @@ struct HTMLAttribute {
|
|||
NS_IF_RELEASE(mAttribute);
|
||||
}
|
||||
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
HTMLAttribute& operator=(const HTMLAttribute& aCopy)
|
||||
{
|
||||
NS_IF_RELEASE(mAttribute);
|
||||
|
@ -117,6 +120,16 @@ struct HTMLAttribute {
|
|||
HTMLAttribute* mNext;
|
||||
};
|
||||
|
||||
void
|
||||
HTMLAttribute::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX mAttribute
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (!aHandler->HaveSeen(mNext)) {
|
||||
mNext->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------
|
||||
|
||||
|
||||
|
@ -152,6 +165,11 @@ public:
|
|||
|
||||
virtual void MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
private:
|
||||
|
@ -524,6 +542,17 @@ void HTMLAttributesImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext*
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLAttributesImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mID
|
||||
// XXX mClass
|
||||
if (!aHandler->HaveSeen(mFirst)) {
|
||||
mFirst->SizeOf(aHandler);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsIContent.h"
|
||||
class nsIAtom;
|
||||
class nsISizeOfHandler;
|
||||
class nsISupportsArray;
|
||||
class nsIHTMLContent;
|
||||
|
||||
|
@ -49,6 +50,11 @@ public:
|
|||
virtual PRInt32 SetClass(nsIAtom* aClass) = 0; // XXX this will have to change for CSS2
|
||||
virtual nsIAtom* GetClass(void) const = 0; // XXX this will have to change for CSS2
|
||||
|
||||
/**
|
||||
* Add this object's size information to the sizeof handler.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче