diff --git a/layout/generic/nsBRFrame.cpp b/layout/generic/nsBRFrame.cpp index 2e1551949b07..e8f3b35b1697 100644 --- a/layout/generic/nsBRFrame.cpp +++ b/layout/generic/nsBRFrame.cpp @@ -36,10 +36,6 @@ public: const nsRect& aDirtyRect); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -85,16 +81,6 @@ BRFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BRFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - NS_IMETHODIMP BRFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index d05547f1c9d2..70cb2f895969 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -16,6 +16,7 @@ * Reserved. */ #include "nsFrame.h" +#include "nsLineLayout.h" #include "nsIContent.h" #include "nsIAtom.h" #include "nsString.h" @@ -303,7 +304,7 @@ NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) return NS_OK; } -NS_METHOD nsFrame::DeleteFrame(nsIPresContext& aPresContext) +NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) { //XXX Why is this done in nsFrame instead of some frame class // that actually loads images? @@ -336,7 +337,7 @@ nsFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const // support } -NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const +NS_IMETHODIMP nsFrame::GetContent(nsIContent*& aContent) const { if (nsnull != mContent) { NS_ADDREF(mContent); @@ -345,7 +346,7 @@ NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const return NS_OK; } -NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext, +NS_IMETHODIMP nsFrame::GetStyleContext(nsIPresContext* aPresContext, nsIStyleContext*& aStyleContext) { if ((nsnull == mStyleContext) && (nsnull != aPresContext)) { @@ -359,7 +360,7 @@ NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext, return NS_OK; } -NS_METHOD nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext) +NS_IMETHODIMP nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext) { NS_PRECONDITION(nsnull != aContext, "null ptr"); if (aContext != mStyleContext) { @@ -375,12 +376,12 @@ NS_METHOD nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* } // Subclass hook for style post processing -NS_METHOD nsFrame::DidSetStyleContext(nsIPresContext* aPresContext) +NS_IMETHODIMP nsFrame::DidSetStyleContext(nsIPresContext* aPresContext) { return NS_OK; } -NS_METHOD nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const +NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const { NS_ASSERTION(mStyleContext!=nsnull,"null style context"); if (mStyleContext) { @@ -393,25 +394,25 @@ NS_METHOD nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aSty // Geometric and content parent member functions -NS_METHOD nsFrame::GetContentParent(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetContentParent(nsIFrame*& aParent) const { aParent = mContentParent; return NS_OK; } -NS_METHOD nsFrame::SetContentParent(const nsIFrame* aParent) +NS_IMETHODIMP nsFrame::SetContentParent(const nsIFrame* aParent) { mContentParent = (nsIFrame*)aParent; return NS_OK; } -NS_METHOD nsFrame::GetGeometricParent(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetGeometricParent(nsIFrame*& aParent) const { aParent = mGeometricParent; return NS_OK; } -NS_METHOD nsFrame::SetGeometricParent(const nsIFrame* aParent) +NS_IMETHODIMP nsFrame::SetGeometricParent(const nsIFrame* aParent) { mGeometricParent = (nsIFrame*)aParent; return NS_OK; @@ -419,34 +420,34 @@ NS_METHOD nsFrame::SetGeometricParent(const nsIFrame* aParent) // Bounding rect member functions -NS_METHOD nsFrame::GetRect(nsRect& aRect) const +NS_IMETHODIMP nsFrame::GetRect(nsRect& aRect) const { aRect = mRect; return NS_OK; } -NS_METHOD nsFrame::GetOrigin(nsPoint& aPoint) const +NS_IMETHODIMP nsFrame::GetOrigin(nsPoint& aPoint) const { aPoint.x = mRect.x; aPoint.y = mRect.y; return NS_OK; } -NS_METHOD nsFrame::GetSize(nsSize& aSize) const +NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const { aSize.width = mRect.width; aSize.height = mRect.height; return NS_OK; } -NS_METHOD nsFrame::SetRect(const nsRect& aRect) +NS_IMETHODIMP nsFrame::SetRect(const nsRect& aRect) { MoveTo(aRect.x, aRect.y); SizeTo(aRect.width, aRect.height); return NS_OK; } -NS_METHOD nsFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) { mRect.x = aX; mRect.y = aY; @@ -467,7 +468,7 @@ NS_METHOD nsFrame::MoveTo(nscoord aX, nscoord aY) return NS_OK; } -NS_METHOD nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) { mRect.width = aWidth; mRect.height = aHeight; @@ -484,7 +485,7 @@ NS_METHOD nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) // Child frame enumeration -NS_METHOD nsFrame::FirstChild(nsIFrame*& aFirstChild) const +NS_IMETHODIMP nsFrame::FirstChild(nsIFrame*& aFirstChild) const { aFirstChild = nsnull; return NS_OK; @@ -511,7 +512,7 @@ PRBool nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurn return result; } -NS_METHOD nsFrame::Paint(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect) { @@ -571,7 +572,7 @@ NS_METHOD nsFrame::Paint(nsIPresContext& aPresContext, /** * */ -NS_METHOD nsFrame::HandleEvent(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -618,7 +619,7 @@ NS_METHOD nsFrame::HandleEvent(nsIPresContext& aPresContext, /** * Handles the Mouse Press Event for the frame */ -NS_METHOD nsFrame::HandlePress(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandlePress(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -804,7 +805,7 @@ NS_METHOD nsFrame::HandlePress(nsIPresContext& aPresContext, } -NS_METHOD nsFrame::HandleDrag(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -928,7 +929,7 @@ NS_METHOD nsFrame::HandleDrag(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::HandleRelease(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -1069,7 +1070,7 @@ void nsFrame::AdjustPointsInSameContent(nsIPresContext& aPresContext, //} } -NS_METHOD nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, const nsPoint& aPoint, nsIFrame** aFrame, nsIContent** aContent, @@ -1081,14 +1082,14 @@ NS_METHOD nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, } // Resize and incremental reflow -NS_METHOD +NS_IMETHODIMP nsFrame::GetFrameState(nsFrameState& aResult) { aResult = mState; return NS_OK; } -NS_METHOD +NS_IMETHODIMP nsFrame::SetFrameState(nsFrameState aNewState) { mState = aNewState; @@ -1097,7 +1098,7 @@ nsFrame::SetFrameState(nsFrameState aNewState) // nsIHTMLReflow member functions -NS_METHOD +NS_IMETHODIMP nsFrame::WillReflow(nsIPresContext& aPresContext) { NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, @@ -1106,7 +1107,7 @@ nsFrame::WillReflow(nsIPresContext& aPresContext) return NS_OK; } -NS_METHOD +NS_IMETHODIMP nsFrame::DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) { @@ -1131,10 +1132,11 @@ nsFrame::DidReflow(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus) +NS_IMETHODIMP +nsFrame::Reflow(nsIPresContext& aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus) { aDesiredSize.width = 0; aDesiredSize.height = 0; @@ -1153,8 +1155,9 @@ NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, - nsHTMLReflowMetrics& aMetrics) +NS_IMETHODIMP +nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, + nsHTMLReflowMetrics& aMetrics) { aMetrics.width = mRect.width; aMetrics.height = mRect.height; @@ -1163,7 +1166,14 @@ NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::ContentChanged(nsIPresContext* aPresContext, +NS_IMETHODIMP +nsFrame::FindTextRuns(nsLineLayout& aLineLayout) +{ + aLineLayout.EndTextRun(); + return NS_OK; +} + +NS_IMETHODIMP nsFrame::ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, nsISupports* aSubContent) { @@ -1180,13 +1190,13 @@ NS_IMETHODIMP nsFrame::AttributeChanged(nsIPresContext* aPresContext, // Flow member functions -NS_METHOD nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const +NS_IMETHODIMP nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const { aIsSplittable = NS_FRAME_NOT_SPLITTABLE; return NS_OK; } -NS_METHOD nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, nsIFrame* aParent, nsIStyleContext* aStyleContext, nsIFrame*& aContinuingFrame) @@ -1196,68 +1206,68 @@ NS_METHOD nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::GetPrevInFlow(nsIFrame*& aPrevInFlow) const +NS_IMETHODIMP nsFrame::GetPrevInFlow(nsIFrame*& aPrevInFlow) const { aPrevInFlow = nsnull; return NS_OK; } -NS_METHOD nsFrame::SetPrevInFlow(nsIFrame*) +NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame*) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::GetNextInFlow(nsIFrame*& aNextInFlow) const +NS_IMETHODIMP nsFrame::GetNextInFlow(nsIFrame*& aNextInFlow) const { aNextInFlow = nsnull; return NS_OK; } -NS_METHOD nsFrame::SetNextInFlow(nsIFrame*) +NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::AppendToFlow(nsIFrame* aAfterFrame) +NS_IMETHODIMP nsFrame::AppendToFlow(nsIFrame* aAfterFrame) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::PrependToFlow(nsIFrame* aBeforeFrame) +NS_IMETHODIMP nsFrame::PrependToFlow(nsIFrame* aBeforeFrame) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::RemoveFromFlow() +NS_IMETHODIMP nsFrame::RemoveFromFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::BreakFromPrevFlow() +NS_IMETHODIMP nsFrame::BreakFromPrevFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::BreakFromNextFlow() +NS_IMETHODIMP nsFrame::BreakFromNextFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } // Associated view object -NS_METHOD nsFrame::GetView(nsIView*& aView) const +NS_IMETHODIMP nsFrame::GetView(nsIView*& aView) const { aView = mView; return NS_OK; } -NS_METHOD nsFrame::SetView(nsIView* aView) +NS_IMETHODIMP nsFrame::SetView(nsIView* aView) { nsresult rv; @@ -1273,7 +1283,7 @@ NS_METHOD nsFrame::SetView(nsIView* aView) } // Find the first geometric parent that has a view -NS_METHOD nsFrame::GetParentWithView(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame*& aParent) const { aParent = mGeometricParent; @@ -1292,7 +1302,7 @@ NS_METHOD nsFrame::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_METHOD nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const +NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const { nsIFrame* frame = (nsIFrame*)this; @@ -1311,7 +1321,7 @@ NS_METHOD nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const return NS_OK; } -NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const +NS_IMETHODIMP nsFrame::GetWindow(nsIWidget*& aWindow) const { nsIFrame* frame = (nsIFrame*)this; @@ -1359,7 +1369,7 @@ nsFrame::Invalidate(const nsRect& aDamageRect, } // Style sizing methods -NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const +NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const { const nsStylePosition* position; GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); @@ -1380,7 +1390,7 @@ NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const return NS_OK; } -NS_METHOD nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const +NS_IMETHODIMP nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const { aSize = 0; // XXX probably not right, subclass override? return NS_OK; @@ -1389,27 +1399,27 @@ NS_METHOD nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const // Sibling pointer used to link together frames -NS_METHOD nsFrame::GetNextSibling(nsIFrame*& aNextSibling) const +NS_IMETHODIMP nsFrame::GetNextSibling(nsIFrame*& aNextSibling) const { aNextSibling = mNextSibling; return NS_OK; } -NS_METHOD nsFrame::SetNextSibling(nsIFrame* aNextSibling) +NS_IMETHODIMP nsFrame::SetNextSibling(nsIFrame* aNextSibling) { mNextSibling = aNextSibling; return NS_OK; } // Transparency query -NS_METHOD nsFrame::IsTransparent(PRBool& aTransparent) const +NS_IMETHODIMP nsFrame::IsTransparent(PRBool& aTransparent) const { //XXX this needs to be overridden in just about every leaf class? MMP aTransparent = PR_TRUE; return NS_OK; } -NS_METHOD nsFrame::Scrolled(nsIView *aView) +NS_IMETHODIMP nsFrame::Scrolled(nsIView *aView) { return NS_OK; } @@ -1435,7 +1445,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) } // Debugging -NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { // if a filter is present, only output this frame if the filter says we should nsIAtom* tag; @@ -1467,7 +1477,7 @@ NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) cons } // Output the frame's tag -NS_METHOD nsFrame::ListTag(FILE* out) const +NS_IMETHODIMP nsFrame::ListTag(FILE* out) const { nsIAtom* tag; mContent->GetTag(tag); @@ -1482,7 +1492,7 @@ NS_METHOD nsFrame::ListTag(FILE* out) const return NS_OK; } -NS_METHOD nsFrame::VerifyTree() const +NS_IMETHODIMP nsFrame::VerifyTree() const { NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow"); return NS_OK; diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 3669a196a1dd..4260794793e5 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -187,6 +187,7 @@ public: nsDidReflowStatus aStatus); NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics); + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); // Selection Methods // XXX Doc me... diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index bf25234f6ff2..e2e88cf25d01 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -68,10 +68,7 @@ public: nsIFrame*& aContinuingFrame); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -237,10 +234,8 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX, return NS_OK; } -#if 0 NS_IMETHODIMP -nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) +nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout) { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsInlineFrame::FindTextRuns")); @@ -252,16 +247,15 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, // Ask each child frame for its text runs nsIFrame* frame = mFirstChild; while (nsnull != frame) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - rv = inlineReflow->FindTextRuns(aLineLayout, aReflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + rv = hr->FindTextRuns(aLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aLineLayout.EndTextRun(); } @@ -272,7 +266,6 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, ("exit nsInlineFrame::FindTextRuns rv=%x", rv)); return rv; } -#endif void nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext, @@ -352,7 +345,6 @@ nsInlineFrame::Reflow(nsIPresContext& aPresContext, NS_ASSERTION(nsnull != aReflowState.spaceManager, "no space manager"); aReflowState.spaceManager->Translate(state.mBorderPadding.left, state.mBorderPadding.top); -nscoord sx, sy; aReflowState.spaceManager->GetTranslation(sx, sy); ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", state.mBorderPadding, sx, sy); // Based on the type of reflow, switch out to the appropriate // routine. @@ -413,13 +405,11 @@ nscoord sx, sy; aReflowState.spaceManager->GetTranslation(sx, sy); ListTag(stdou aStatus = ResizeReflow(state, inlineReflow); } ComputeFinalSize(state, inlineReflow, aMetrics); -// ListTag(stdout); printf(": exit carriedMargins=%d,%d\n", aMetrics.mCarriedOutTopMargin, aMetrics.mCarriedOutBottomMargin); // Now translate in by our border and padding aReflowState.lineLayout->PopInline(); aReflowState.spaceManager->Translate(-state.mBorderPadding.left, -state.mBorderPadding.top); -ListTag(stdout); printf(": END\n"); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsInlineFrame::InlineReflow size=%d,%d status=%x nif=%p", @@ -771,7 +761,6 @@ nsInlineFrame::ReflowFrame(nsInlineReflowState& aState, } } -ListTag(stdout); printf(": child="); aFrame->ListTag(stdout); printf(": reflowStatus=%x\n", aReflowStatus); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("nsInlineFrame::ReflowMapped: frame=%p reflowStatus=%x", aFrame, aReflowStatus)); diff --git a/layout/generic/nsPlaceholderFrame.cpp b/layout/generic/nsPlaceholderFrame.cpp index 279f685754d2..4aac0c877fef 100644 --- a/layout/generic/nsPlaceholderFrame.cpp +++ b/layout/generic/nsPlaceholderFrame.cpp @@ -56,16 +56,6 @@ nsPlaceholderFrame::~nsPlaceholderFrame() { } -#if 0 -NS_IMETHODIMP -nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - NS_IMETHODIMP nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/generic/nsSpacerFrame.cpp b/layout/generic/nsSpacerFrame.cpp index 11de196f7224..67f1f43bc061 100644 --- a/layout/generic/nsSpacerFrame.cpp +++ b/layout/generic/nsSpacerFrame.cpp @@ -37,10 +37,6 @@ public: SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -150,16 +146,6 @@ SpacerFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - PRUint8 SpacerFrame::GetType() { diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 1fbdd9abaf4c..b97b2295ff0f 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -145,10 +145,7 @@ public: PRInt32& aOffset); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -1192,17 +1189,14 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext, NS_RELEASE(doc); } -#if 0 NS_IMETHODIMP -TextFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) +TextFrame::FindTextRuns(nsLineLayout& aLineLayout) { if (nsnull == mPrevInFlow) { aLineLayout.AddText(this); } return NS_OK; } -#endif //--------------------------------------------------- // Uses a binary search for find where the cursor falls in the line of text diff --git a/layout/html/base/src/nsBRFrame.cpp b/layout/html/base/src/nsBRFrame.cpp index 2e1551949b07..e8f3b35b1697 100644 --- a/layout/html/base/src/nsBRFrame.cpp +++ b/layout/html/base/src/nsBRFrame.cpp @@ -36,10 +36,6 @@ public: const nsRect& aDirtyRect); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -85,16 +81,6 @@ BRFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BRFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - NS_IMETHODIMP BRFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index 058936e83cde..7c7531c3cbc6 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -314,9 +314,7 @@ public: nsresult StyleChangedReflow(nsBlockReflowState& aState); -#if 0 nsresult FindTextRuns(nsBlockReflowState& aState); -#endif nsresult ChildIncrementalReflow(nsBlockReflowState& aState); @@ -414,10 +412,6 @@ public: NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -847,16 +841,6 @@ BulletFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -BulletFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - //---------------------------------------------------------------------- #define LINE_IS_DIRTY 0x1 @@ -1304,7 +1288,6 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, // coordinate system origin for later. mSpaceManager->Translate(mBorderPadding.left, mBorderPadding.top); mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY); -frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", mBorderPadding, mSpaceManagerX, mSpaceManagerY); mPresContext = aPresContext; mBlock = (nsBlockFrame*) frame; @@ -1371,7 +1354,6 @@ frame->ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", m nsBlockReflowState::~nsBlockReflowState() { -frame->ListTag(stdout); printf(": END\n"); // Restore the coordinate system mSpaceManager->Translate(-mBorderPadding.left, -mBorderPadding.top); @@ -1415,7 +1397,6 @@ nsBlockReflowState::GetAvailableSpace() // Compute the bounding rect of the available space, i.e. space // between any left and right floaters. mCurrentBand.ComputeAvailSpaceRect(); -mBlock->ListTag(stdout); printf(": availSpace=%d,%d,%d,%d\n", mCurrentBand.availSpace); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsBlockReflowState::GetAvailableSpace: band={%d,%d,%d,%d} count=%d", @@ -2122,13 +2103,11 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext, nsresult nsBlockFrame::InitialReflow(nsBlockReflowState& aState) { -#if 0 // Generate text-run information nsresult rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Reflow everything aState.GetAvailableSpace(); @@ -2182,13 +2161,11 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) // impacted line will be marked dirty AppendNewFrames(aState.mPresContext, firstAppendedFrame); -#if 0 // Generate text-run information rv = FindTextRuns(aState); if (NS_OK != rv) { return rv; } -#endif // Recover our reflow state LineData* firstDirtyLine = mLines; @@ -2245,7 +2222,6 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState) return ReflowLinesAt(aState, firstDirtyLine); } -#if 0 // XXX keep the text-run data in the first-in-flow of the block nsresult nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) @@ -2262,17 +2238,15 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) nsIFrame* frame = line->mFirstChild; PRInt32 n = line->mChildCount; while (--n >= 0) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - nsresult rv = inlineReflow->FindTextRuns(aState.mLineLayout, - aState.reflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + nsresult rv = hr->FindTextRuns(aState.mLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aState.mLineLayout.EndTextRun(); } @@ -2293,7 +2267,6 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState) return NS_OK; } -#endif nsresult nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState) diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index d05547f1c9d2..70cb2f895969 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -16,6 +16,7 @@ * Reserved. */ #include "nsFrame.h" +#include "nsLineLayout.h" #include "nsIContent.h" #include "nsIAtom.h" #include "nsString.h" @@ -303,7 +304,7 @@ NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) return NS_OK; } -NS_METHOD nsFrame::DeleteFrame(nsIPresContext& aPresContext) +NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) { //XXX Why is this done in nsFrame instead of some frame class // that actually loads images? @@ -336,7 +337,7 @@ nsFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const // support } -NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const +NS_IMETHODIMP nsFrame::GetContent(nsIContent*& aContent) const { if (nsnull != mContent) { NS_ADDREF(mContent); @@ -345,7 +346,7 @@ NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const return NS_OK; } -NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext, +NS_IMETHODIMP nsFrame::GetStyleContext(nsIPresContext* aPresContext, nsIStyleContext*& aStyleContext) { if ((nsnull == mStyleContext) && (nsnull != aPresContext)) { @@ -359,7 +360,7 @@ NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext, return NS_OK; } -NS_METHOD nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext) +NS_IMETHODIMP nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext) { NS_PRECONDITION(nsnull != aContext, "null ptr"); if (aContext != mStyleContext) { @@ -375,12 +376,12 @@ NS_METHOD nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* } // Subclass hook for style post processing -NS_METHOD nsFrame::DidSetStyleContext(nsIPresContext* aPresContext) +NS_IMETHODIMP nsFrame::DidSetStyleContext(nsIPresContext* aPresContext) { return NS_OK; } -NS_METHOD nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const +NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const { NS_ASSERTION(mStyleContext!=nsnull,"null style context"); if (mStyleContext) { @@ -393,25 +394,25 @@ NS_METHOD nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aSty // Geometric and content parent member functions -NS_METHOD nsFrame::GetContentParent(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetContentParent(nsIFrame*& aParent) const { aParent = mContentParent; return NS_OK; } -NS_METHOD nsFrame::SetContentParent(const nsIFrame* aParent) +NS_IMETHODIMP nsFrame::SetContentParent(const nsIFrame* aParent) { mContentParent = (nsIFrame*)aParent; return NS_OK; } -NS_METHOD nsFrame::GetGeometricParent(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetGeometricParent(nsIFrame*& aParent) const { aParent = mGeometricParent; return NS_OK; } -NS_METHOD nsFrame::SetGeometricParent(const nsIFrame* aParent) +NS_IMETHODIMP nsFrame::SetGeometricParent(const nsIFrame* aParent) { mGeometricParent = (nsIFrame*)aParent; return NS_OK; @@ -419,34 +420,34 @@ NS_METHOD nsFrame::SetGeometricParent(const nsIFrame* aParent) // Bounding rect member functions -NS_METHOD nsFrame::GetRect(nsRect& aRect) const +NS_IMETHODIMP nsFrame::GetRect(nsRect& aRect) const { aRect = mRect; return NS_OK; } -NS_METHOD nsFrame::GetOrigin(nsPoint& aPoint) const +NS_IMETHODIMP nsFrame::GetOrigin(nsPoint& aPoint) const { aPoint.x = mRect.x; aPoint.y = mRect.y; return NS_OK; } -NS_METHOD nsFrame::GetSize(nsSize& aSize) const +NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const { aSize.width = mRect.width; aSize.height = mRect.height; return NS_OK; } -NS_METHOD nsFrame::SetRect(const nsRect& aRect) +NS_IMETHODIMP nsFrame::SetRect(const nsRect& aRect) { MoveTo(aRect.x, aRect.y); SizeTo(aRect.width, aRect.height); return NS_OK; } -NS_METHOD nsFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) { mRect.x = aX; mRect.y = aY; @@ -467,7 +468,7 @@ NS_METHOD nsFrame::MoveTo(nscoord aX, nscoord aY) return NS_OK; } -NS_METHOD nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) { mRect.width = aWidth; mRect.height = aHeight; @@ -484,7 +485,7 @@ NS_METHOD nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) // Child frame enumeration -NS_METHOD nsFrame::FirstChild(nsIFrame*& aFirstChild) const +NS_IMETHODIMP nsFrame::FirstChild(nsIFrame*& aFirstChild) const { aFirstChild = nsnull; return NS_OK; @@ -511,7 +512,7 @@ PRBool nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurn return result; } -NS_METHOD nsFrame::Paint(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect) { @@ -571,7 +572,7 @@ NS_METHOD nsFrame::Paint(nsIPresContext& aPresContext, /** * */ -NS_METHOD nsFrame::HandleEvent(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -618,7 +619,7 @@ NS_METHOD nsFrame::HandleEvent(nsIPresContext& aPresContext, /** * Handles the Mouse Press Event for the frame */ -NS_METHOD nsFrame::HandlePress(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandlePress(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -804,7 +805,7 @@ NS_METHOD nsFrame::HandlePress(nsIPresContext& aPresContext, } -NS_METHOD nsFrame::HandleDrag(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -928,7 +929,7 @@ NS_METHOD nsFrame::HandleDrag(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::HandleRelease(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { @@ -1069,7 +1070,7 @@ void nsFrame::AdjustPointsInSameContent(nsIPresContext& aPresContext, //} } -NS_METHOD nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, const nsPoint& aPoint, nsIFrame** aFrame, nsIContent** aContent, @@ -1081,14 +1082,14 @@ NS_METHOD nsFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, } // Resize and incremental reflow -NS_METHOD +NS_IMETHODIMP nsFrame::GetFrameState(nsFrameState& aResult) { aResult = mState; return NS_OK; } -NS_METHOD +NS_IMETHODIMP nsFrame::SetFrameState(nsFrameState aNewState) { mState = aNewState; @@ -1097,7 +1098,7 @@ nsFrame::SetFrameState(nsFrameState aNewState) // nsIHTMLReflow member functions -NS_METHOD +NS_IMETHODIMP nsFrame::WillReflow(nsIPresContext& aPresContext) { NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, @@ -1106,7 +1107,7 @@ nsFrame::WillReflow(nsIPresContext& aPresContext) return NS_OK; } -NS_METHOD +NS_IMETHODIMP nsFrame::DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) { @@ -1131,10 +1132,11 @@ nsFrame::DidReflow(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus) +NS_IMETHODIMP +nsFrame::Reflow(nsIPresContext& aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus) { aDesiredSize.width = 0; aDesiredSize.height = 0; @@ -1153,8 +1155,9 @@ NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, - nsHTMLReflowMetrics& aMetrics) +NS_IMETHODIMP +nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, + nsHTMLReflowMetrics& aMetrics) { aMetrics.width = mRect.width; aMetrics.height = mRect.height; @@ -1163,7 +1166,14 @@ NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::ContentChanged(nsIPresContext* aPresContext, +NS_IMETHODIMP +nsFrame::FindTextRuns(nsLineLayout& aLineLayout) +{ + aLineLayout.EndTextRun(); + return NS_OK; +} + +NS_IMETHODIMP nsFrame::ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, nsISupports* aSubContent) { @@ -1180,13 +1190,13 @@ NS_IMETHODIMP nsFrame::AttributeChanged(nsIPresContext* aPresContext, // Flow member functions -NS_METHOD nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const +NS_IMETHODIMP nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const { aIsSplittable = NS_FRAME_NOT_SPLITTABLE; return NS_OK; } -NS_METHOD nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, +NS_IMETHODIMP nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, nsIFrame* aParent, nsIStyleContext* aStyleContext, nsIFrame*& aContinuingFrame) @@ -1196,68 +1206,68 @@ NS_METHOD nsFrame::CreateContinuingFrame(nsIPresContext& aPresContext, return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::GetPrevInFlow(nsIFrame*& aPrevInFlow) const +NS_IMETHODIMP nsFrame::GetPrevInFlow(nsIFrame*& aPrevInFlow) const { aPrevInFlow = nsnull; return NS_OK; } -NS_METHOD nsFrame::SetPrevInFlow(nsIFrame*) +NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame*) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::GetNextInFlow(nsIFrame*& aNextInFlow) const +NS_IMETHODIMP nsFrame::GetNextInFlow(nsIFrame*& aNextInFlow) const { aNextInFlow = nsnull; return NS_OK; } -NS_METHOD nsFrame::SetNextInFlow(nsIFrame*) +NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::AppendToFlow(nsIFrame* aAfterFrame) +NS_IMETHODIMP nsFrame::AppendToFlow(nsIFrame* aAfterFrame) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::PrependToFlow(nsIFrame* aBeforeFrame) +NS_IMETHODIMP nsFrame::PrependToFlow(nsIFrame* aBeforeFrame) { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::RemoveFromFlow() +NS_IMETHODIMP nsFrame::RemoveFromFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::BreakFromPrevFlow() +NS_IMETHODIMP nsFrame::BreakFromPrevFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } -NS_METHOD nsFrame::BreakFromNextFlow() +NS_IMETHODIMP nsFrame::BreakFromNextFlow() { NS_ERROR("not splittable"); return NS_ERROR_NOT_IMPLEMENTED; } // Associated view object -NS_METHOD nsFrame::GetView(nsIView*& aView) const +NS_IMETHODIMP nsFrame::GetView(nsIView*& aView) const { aView = mView; return NS_OK; } -NS_METHOD nsFrame::SetView(nsIView* aView) +NS_IMETHODIMP nsFrame::SetView(nsIView* aView) { nsresult rv; @@ -1273,7 +1283,7 @@ NS_METHOD nsFrame::SetView(nsIView* aView) } // Find the first geometric parent that has a view -NS_METHOD nsFrame::GetParentWithView(nsIFrame*& aParent) const +NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame*& aParent) const { aParent = mGeometricParent; @@ -1292,7 +1302,7 @@ NS_METHOD nsFrame::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_METHOD nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const +NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const { nsIFrame* frame = (nsIFrame*)this; @@ -1311,7 +1321,7 @@ NS_METHOD nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView*& aView) const return NS_OK; } -NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const +NS_IMETHODIMP nsFrame::GetWindow(nsIWidget*& aWindow) const { nsIFrame* frame = (nsIFrame*)this; @@ -1359,7 +1369,7 @@ nsFrame::Invalidate(const nsRect& aDamageRect, } // Style sizing methods -NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const +NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const { const nsStylePosition* position; GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); @@ -1380,7 +1390,7 @@ NS_METHOD nsFrame::IsPercentageBase(PRBool& aBase) const return NS_OK; } -NS_METHOD nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const +NS_IMETHODIMP nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const { aSize = 0; // XXX probably not right, subclass override? return NS_OK; @@ -1389,27 +1399,27 @@ NS_METHOD nsFrame::GetAutoMarginSize(PRUint8 aSide, nscoord& aSize) const // Sibling pointer used to link together frames -NS_METHOD nsFrame::GetNextSibling(nsIFrame*& aNextSibling) const +NS_IMETHODIMP nsFrame::GetNextSibling(nsIFrame*& aNextSibling) const { aNextSibling = mNextSibling; return NS_OK; } -NS_METHOD nsFrame::SetNextSibling(nsIFrame* aNextSibling) +NS_IMETHODIMP nsFrame::SetNextSibling(nsIFrame* aNextSibling) { mNextSibling = aNextSibling; return NS_OK; } // Transparency query -NS_METHOD nsFrame::IsTransparent(PRBool& aTransparent) const +NS_IMETHODIMP nsFrame::IsTransparent(PRBool& aTransparent) const { //XXX this needs to be overridden in just about every leaf class? MMP aTransparent = PR_TRUE; return NS_OK; } -NS_METHOD nsFrame::Scrolled(nsIView *aView) +NS_IMETHODIMP nsFrame::Scrolled(nsIView *aView) { return NS_OK; } @@ -1435,7 +1445,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) } // Debugging -NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { // if a filter is present, only output this frame if the filter says we should nsIAtom* tag; @@ -1467,7 +1477,7 @@ NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) cons } // Output the frame's tag -NS_METHOD nsFrame::ListTag(FILE* out) const +NS_IMETHODIMP nsFrame::ListTag(FILE* out) const { nsIAtom* tag; mContent->GetTag(tag); @@ -1482,7 +1492,7 @@ NS_METHOD nsFrame::ListTag(FILE* out) const return NS_OK; } -NS_METHOD nsFrame::VerifyTree() const +NS_IMETHODIMP nsFrame::VerifyTree() const { NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow"); return NS_OK; diff --git a/layout/html/base/src/nsFrame.h b/layout/html/base/src/nsFrame.h index 3669a196a1dd..4260794793e5 100644 --- a/layout/html/base/src/nsFrame.h +++ b/layout/html/base/src/nsFrame.h @@ -187,6 +187,7 @@ public: nsDidReflowStatus aStatus); NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics); + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); // Selection Methods // XXX Doc me... diff --git a/layout/html/base/src/nsIHTMLReflow.h b/layout/html/base/src/nsIHTMLReflow.h index 57e28512baa1..0fec8ff46254 100644 --- a/layout/html/base/src/nsIHTMLReflow.h +++ b/layout/html/base/src/nsIHTMLReflow.h @@ -213,6 +213,10 @@ struct nsHTMLReflowState : nsReflowState { */ class nsIHTMLReflow : public nsIFrameReflow { +public: + // Helper method used by block reflow to identify runs of text so that + // proper word-breaking can be done. + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout) = 0; }; //---------------------------------------------------------------------- diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index bf25234f6ff2..e2e88cf25d01 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -68,10 +68,7 @@ public: nsIFrame*& aContinuingFrame); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -237,10 +234,8 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX, return NS_OK; } -#if 0 NS_IMETHODIMP -nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) +nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout) { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsInlineFrame::FindTextRuns")); @@ -252,16 +247,15 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, // Ask each child frame for its text runs nsIFrame* frame = mFirstChild; while (nsnull != frame) { - nsIInlineReflow* inlineReflow; - if (NS_OK == frame->QueryInterface(kIInlineReflowIID, - (void**)&inlineReflow)) { - rv = inlineReflow->FindTextRuns(aLineLayout, aReflowCommand); + nsIHTMLReflow* hr; + if (NS_OK == frame->QueryInterface(kIHTMLReflowIID, (void**)&hr)) { + rv = hr->FindTextRuns(aLineLayout); if (NS_OK != rv) { return rv; } } else { - // A frame that doesn't implement nsIInlineReflow isn't text + // A frame that doesn't implement nsIHTMLReflow isn't text // therefore it will end an open text run. aLineLayout.EndTextRun(); } @@ -272,7 +266,6 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout, ("exit nsInlineFrame::FindTextRuns rv=%x", rv)); return rv; } -#endif void nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext, @@ -352,7 +345,6 @@ nsInlineFrame::Reflow(nsIPresContext& aPresContext, NS_ASSERTION(nsnull != aReflowState.spaceManager, "no space manager"); aReflowState.spaceManager->Translate(state.mBorderPadding.left, state.mBorderPadding.top); -nscoord sx, sy; aReflowState.spaceManager->GetTranslation(sx, sy); ListTag(stdout); printf(": BEGIN: BP=%d,%d,%d,%d spaceManager=%d,%d\n", state.mBorderPadding, sx, sy); // Based on the type of reflow, switch out to the appropriate // routine. @@ -413,13 +405,11 @@ nscoord sx, sy; aReflowState.spaceManager->GetTranslation(sx, sy); ListTag(stdou aStatus = ResizeReflow(state, inlineReflow); } ComputeFinalSize(state, inlineReflow, aMetrics); -// ListTag(stdout); printf(": exit carriedMargins=%d,%d\n", aMetrics.mCarriedOutTopMargin, aMetrics.mCarriedOutBottomMargin); // Now translate in by our border and padding aReflowState.lineLayout->PopInline(); aReflowState.spaceManager->Translate(-state.mBorderPadding.left, -state.mBorderPadding.top); -ListTag(stdout); printf(": END\n"); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsInlineFrame::InlineReflow size=%d,%d status=%x nif=%p", @@ -771,7 +761,6 @@ nsInlineFrame::ReflowFrame(nsInlineReflowState& aState, } } -ListTag(stdout); printf(": child="); aFrame->ListTag(stdout); printf(": reflowStatus=%x\n", aReflowStatus); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("nsInlineFrame::ReflowMapped: frame=%p reflowStatus=%x", aFrame, aReflowStatus)); diff --git a/layout/html/base/src/nsInlineReflow.cpp b/layout/html/base/src/nsInlineReflow.cpp index 8cface7c1131..fa76d242eade 100644 --- a/layout/html/base/src/nsInlineReflow.cpp +++ b/layout/html/base/src/nsInlineReflow.cpp @@ -62,7 +62,6 @@ nsInlineReflow::~nsInlineReflow() void nsInlineReflow::Init(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) { -mOuterFrame->ListTag(stdout); printf(": IR: init: %d,%d,%d,%d\n", aX, aY, aWidth, aHeight); mLeftEdge = aX; mX = aX; if (NS_UNCONSTRAINEDSIZE == aWidth) { @@ -99,7 +98,6 @@ nsInlineReflow::UpdateBand(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPlacedLeftFloater) { -mOuterFrame->ListTag(stdout); printf(": IR: update: %d,%d,%d,%d\n", aX, aY, aWidth, aHeight, aPlacedLeftFloater ? "left" : "right"); NS_PRECONDITION(mX == mLeftEdge, "update-band called after place-frame"); mLeftEdge = aX; diff --git a/layout/html/base/src/nsPlaceholderFrame.cpp b/layout/html/base/src/nsPlaceholderFrame.cpp index 279f685754d2..4aac0c877fef 100644 --- a/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/layout/html/base/src/nsPlaceholderFrame.cpp @@ -56,16 +56,6 @@ nsPlaceholderFrame::~nsPlaceholderFrame() { } -#if 0 -NS_IMETHODIMP -nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - NS_IMETHODIMP nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/base/src/nsSpacerFrame.cpp b/layout/html/base/src/nsSpacerFrame.cpp index 11de196f7224..67f1f43bc061 100644 --- a/layout/html/base/src/nsSpacerFrame.cpp +++ b/layout/html/base/src/nsSpacerFrame.cpp @@ -37,10 +37,6 @@ public: SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -150,16 +146,6 @@ SpacerFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -#if 0 -NS_IMETHODIMP -SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) -{ - aLineLayout.EndTextRun(); - return NS_OK; -} -#endif - PRUint8 SpacerFrame::GetType() { diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index 1fbdd9abaf4c..b97b2295ff0f 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -145,10 +145,7 @@ public: PRInt32& aOffset); // nsIHTMLReflow -#if 0 - NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand); -#endif + NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, @@ -1192,17 +1189,14 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext, NS_RELEASE(doc); } -#if 0 NS_IMETHODIMP -TextFrame::FindTextRuns(nsLineLayout& aLineLayout, - nsIReflowCommand* aReflowCommand) +TextFrame::FindTextRuns(nsLineLayout& aLineLayout) { if (nsnull == mPrevInFlow) { aLineLayout.AddText(this); } return NS_OK; } -#endif //--------------------------------------------------- // Uses a binary search for find where the cursor falls in the line of text