diff --git a/layout/generic/nsPlaceholderFrame.cpp b/layout/generic/nsPlaceholderFrame.cpp index 5fdee164ea2b..ac3f10acb745 100644 --- a/layout/generic/nsPlaceholderFrame.cpp +++ b/layout/generic/nsPlaceholderFrame.cpp @@ -25,10 +25,10 @@ #include "nsIStyleContext.h" nsresult -nsPlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, - nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aAnchoredItem) +NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult, + nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -54,34 +54,6 @@ nsPlaceholderFrame::~nsPlaceholderFrame() { } -// XXX Major hack... -NS_IMETHODIMP -nsPlaceholderFrame::DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) -{ - // XXX Floated frame isn't in the block frame's list of children so make - // sure it gets a DidReflow notification - if (nsnull != mAnchoredItem) { - nsIHTMLReflow* htmlReflow; - if (NS_SUCCEEDED(mAnchoredItem->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow))) { - htmlReflow->DidReflow(aPresContext, aStatus); - } - } - - return nsFrame::DidReflow(aPresContext, aStatus); -} - -// XXX Major hack... -NS_IMETHODIMP -nsPlaceholderFrame::DeleteFrame(nsIPresContext& aPresContext) -{ - // XXX Delete the floated frame - if (nsnull != mAnchoredItem) { - mAnchoredItem->DeleteFrame(aPresContext); - } - - return nsFrame::DeleteFrame(aPresContext); -} - NS_IMETHODIMP nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -119,16 +91,19 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, float p2t = aPresContext.GetPixelsToTwips(); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); nscoord x = NSIntPixelsToTwips(-5, p2t); - aRenderingContext.FillRect(x, 0, NSIntPixelsToTwips(13, p2t), NSIntPixelsToTwips(3, p2t)); + aRenderingContext.FillRect(x, 0, NSIntPixelsToTwips(13, p2t), + NSIntPixelsToTwips(3, p2t)); nscoord y = NSIntPixelsToTwips(-10, p2t); - aRenderingContext.FillRect(0, y, NSIntPixelsToTwips(3, p2t), NSIntPixelsToTwips(10, p2t)); + aRenderingContext.FillRect(0, y, NSIntPixelsToTwips(3, p2t), + NSIntPixelsToTwips(10, p2t)); } return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - nsISupports* aSubContent) +NS_IMETHODIMP +nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsISupports* aSubContent) { NS_ASSERTION(mContent == aChild, "bad content-changed target"); @@ -136,7 +111,6 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, if (nsnull != mAnchoredItem) { return mAnchoredItem->ContentChanged(aPresContext, aChild, aSubContent); } - return NS_OK; } @@ -148,13 +122,14 @@ nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext, { // Forward the notification to the floater if (nsnull != mAnchoredItem) { - return mAnchoredItem->AttributeChanged(aPresContext, aChild, aAttribute, aHint); + return mAnchoredItem->AttributeChanged(aPresContext, aChild, + aAttribute, aHint); } - return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ListTag(FILE* out) const +NS_IMETHODIMP +nsPlaceholderFrame::ListTag(FILE* out) const { fputs("*placeholder", out); fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this); diff --git a/layout/generic/nsPlaceholderFrame.h b/layout/generic/nsPlaceholderFrame.h index 76e953b9b25a..884ce6dc4d5c 100644 --- a/layout/generic/nsPlaceholderFrame.h +++ b/layout/generic/nsPlaceholderFrame.h @@ -20,37 +20,34 @@ #include "nsFrame.h" -// Implementation of a frame that's used as a placeholder for an anchored item - +/** + * Implementation of a frame that's used as a placeholder for an anchored item + */ class nsPlaceholderFrame : public nsFrame { public: /** * Create a new placeholder frame */ - static nsresult NewFrame(nsIFrame** aInstancePtrResult, - nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aAnchoredItem = nsnull); + friend nsresult NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult, + nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem = nsnull); - // Returns the associated anchored item - nsIFrame* GetAnchoredItem() const {return mAnchoredItem;} - void SetAnchoredItem(nsIFrame* aAnchoredItem) {mAnchoredItem = aAnchoredItem;} + // Get/Set the associated anchored item + nsIFrame* GetAnchoredItem() const { + return mAnchoredItem; + } + void SetAnchoredItem(nsIFrame* aAnchoredItem) { + mAnchoredItem = aAnchoredItem; + } // nsIHTMLReflow overrides -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); // nsIFrame overrides - NS_IMETHOD DidReflow(nsIPresContext& aPresContext, - nsDidReflowStatus aStatus); - NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); - NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); @@ -67,12 +64,14 @@ public: NS_IMETHOD ListTag(FILE* out = stdout) const; protected: - nsIFrame* mAnchoredItem; - // Constructor. Takes as arguments the content object and the Frame for // the content parent - nsPlaceholderFrame(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aAnchoredItem); + nsPlaceholderFrame(nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem); virtual ~nsPlaceholderFrame(); + + nsIFrame* mAnchoredItem; }; #endif /* nsPlaceholderFrame_h___ */ diff --git a/layout/html/base/src/nsPlaceholderFrame.cpp b/layout/html/base/src/nsPlaceholderFrame.cpp index 5fdee164ea2b..ac3f10acb745 100644 --- a/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/layout/html/base/src/nsPlaceholderFrame.cpp @@ -25,10 +25,10 @@ #include "nsIStyleContext.h" nsresult -nsPlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, - nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aAnchoredItem) +NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult, + nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -54,34 +54,6 @@ nsPlaceholderFrame::~nsPlaceholderFrame() { } -// XXX Major hack... -NS_IMETHODIMP -nsPlaceholderFrame::DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) -{ - // XXX Floated frame isn't in the block frame's list of children so make - // sure it gets a DidReflow notification - if (nsnull != mAnchoredItem) { - nsIHTMLReflow* htmlReflow; - if (NS_SUCCEEDED(mAnchoredItem->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow))) { - htmlReflow->DidReflow(aPresContext, aStatus); - } - } - - return nsFrame::DidReflow(aPresContext, aStatus); -} - -// XXX Major hack... -NS_IMETHODIMP -nsPlaceholderFrame::DeleteFrame(nsIPresContext& aPresContext) -{ - // XXX Delete the floated frame - if (nsnull != mAnchoredItem) { - mAnchoredItem->DeleteFrame(aPresContext); - } - - return nsFrame::DeleteFrame(aPresContext); -} - NS_IMETHODIMP nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -119,16 +91,19 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, float p2t = aPresContext.GetPixelsToTwips(); aRenderingContext.SetColor(NS_RGB(0, 255, 255)); nscoord x = NSIntPixelsToTwips(-5, p2t); - aRenderingContext.FillRect(x, 0, NSIntPixelsToTwips(13, p2t), NSIntPixelsToTwips(3, p2t)); + aRenderingContext.FillRect(x, 0, NSIntPixelsToTwips(13, p2t), + NSIntPixelsToTwips(3, p2t)); nscoord y = NSIntPixelsToTwips(-10, p2t); - aRenderingContext.FillRect(0, y, NSIntPixelsToTwips(3, p2t), NSIntPixelsToTwips(10, p2t)); + aRenderingContext.FillRect(0, y, NSIntPixelsToTwips(3, p2t), + NSIntPixelsToTwips(10, p2t)); } return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - nsISupports* aSubContent) +NS_IMETHODIMP +nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsISupports* aSubContent) { NS_ASSERTION(mContent == aChild, "bad content-changed target"); @@ -136,7 +111,6 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext, if (nsnull != mAnchoredItem) { return mAnchoredItem->ContentChanged(aPresContext, aChild, aSubContent); } - return NS_OK; } @@ -148,13 +122,14 @@ nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext, { // Forward the notification to the floater if (nsnull != mAnchoredItem) { - return mAnchoredItem->AttributeChanged(aPresContext, aChild, aAttribute, aHint); + return mAnchoredItem->AttributeChanged(aPresContext, aChild, + aAttribute, aHint); } - return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ListTag(FILE* out) const +NS_IMETHODIMP +nsPlaceholderFrame::ListTag(FILE* out) const { fputs("*placeholder", out); fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this); diff --git a/layout/html/base/src/nsPlaceholderFrame.h b/layout/html/base/src/nsPlaceholderFrame.h index 76e953b9b25a..884ce6dc4d5c 100644 --- a/layout/html/base/src/nsPlaceholderFrame.h +++ b/layout/html/base/src/nsPlaceholderFrame.h @@ -20,37 +20,34 @@ #include "nsFrame.h" -// Implementation of a frame that's used as a placeholder for an anchored item - +/** + * Implementation of a frame that's used as a placeholder for an anchored item + */ class nsPlaceholderFrame : public nsFrame { public: /** * Create a new placeholder frame */ - static nsresult NewFrame(nsIFrame** aInstancePtrResult, - nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aAnchoredItem = nsnull); + friend nsresult NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult, + nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem = nsnull); - // Returns the associated anchored item - nsIFrame* GetAnchoredItem() const {return mAnchoredItem;} - void SetAnchoredItem(nsIFrame* aAnchoredItem) {mAnchoredItem = aAnchoredItem;} + // Get/Set the associated anchored item + nsIFrame* GetAnchoredItem() const { + return mAnchoredItem; + } + void SetAnchoredItem(nsIFrame* aAnchoredItem) { + mAnchoredItem = aAnchoredItem; + } // nsIHTMLReflow overrides -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); // nsIFrame overrides - NS_IMETHOD DidReflow(nsIPresContext& aPresContext, - nsDidReflowStatus aStatus); - NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); - NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); @@ -67,12 +64,14 @@ public: NS_IMETHOD ListTag(FILE* out = stdout) const; protected: - nsIFrame* mAnchoredItem; - // Constructor. Takes as arguments the content object and the Frame for // the content parent - nsPlaceholderFrame(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aAnchoredItem); + nsPlaceholderFrame(nsIContent* aContent, + nsIFrame* aParent, + nsIFrame* aAnchoredItem); virtual ~nsPlaceholderFrame(); + + nsIFrame* mAnchoredItem; }; #endif /* nsPlaceholderFrame_h___ */