From 04bd3565f55bfd382c5e5df0179989691c6d3c3b Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Sat, 5 Dec 1998 16:01:11 +0000 Subject: [PATCH] Updated git-svn-id: svn://10.0.0.236/trunk@15839 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/generic/nsBlockReflowContext.cpp | 19 ++++++++++--------- mozilla/layout/generic/nsBlockReflowContext.h | 3 ++- mozilla/layout/generic/nsLineBox.cpp | 18 ++++++++++++++++++ mozilla/layout/generic/nsLineBox.h | 8 ++++---- .../html/base/src/nsBlockReflowContext.cpp | 19 ++++++++++--------- .../html/base/src/nsBlockReflowContext.h | 3 ++- mozilla/layout/html/base/src/nsLineBox.cpp | 18 ++++++++++++++++++ mozilla/layout/html/base/src/nsLineBox.h | 8 ++++---- 8 files changed, 68 insertions(+), 28 deletions(-) diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index e0c15a823e6..4a205d2e2a1 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -71,10 +71,10 @@ nsBlockReflowContext::ComputeMarginsFor(nsIPresContext& aPresContext, } nsresult -nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) +nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace, + nsReflowStatus& aFrameReflowStatus) { - nsReflowStatus reflowStatus; - + nsresult rv = NS_OK; mFrame = aFrame; mSpace = aSpace; @@ -127,8 +127,8 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) // Let frame know that we are reflowing it nsIHTMLReflow* htmlReflow; - nsresult rv = aFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow); - if (!NS_SUCCEEDED(rv)) { + rv = aFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow); + if (NS_FAILED(rv)) { return rv; } htmlReflow->WillReflow(mPresContext); @@ -144,7 +144,8 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) nscoord ty = y - mOuterReflowState.mBorderPadding.top; aFrame->MoveTo(x, y); mOuterReflowState.spaceManager->Translate(tx, ty); - htmlReflow->Reflow(mPresContext, mMetrics, reflowState, reflowStatus); + rv = htmlReflow->Reflow(mPresContext, mMetrics, reflowState, + aFrameReflowStatus); mOuterReflowState.spaceManager->Translate(-tx, -ty); aFrame->GetFrameState(state); @@ -163,12 +164,12 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) aFrame->SetFrameState(state & ~NS_FRAME_FIRST_REFLOW); } - if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) { + if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { // If frame is complete and has a next-in-flow, we need to delete // them now. Do not do this when a break-before is signaled because // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up). - if (NS_FRAME_IS_COMPLETE(reflowStatus)) { + if (NS_FRAME_IS_COMPLETE(aFrameReflowStatus)) { nsIFrame* kidNextInFlow; aFrame->GetNextInFlow(kidNextInFlow); if (nsnull != kidNextInFlow) { @@ -183,7 +184,7 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) } } - return reflowStatus; + return rv; } /** diff --git a/mozilla/layout/generic/nsBlockReflowContext.h b/mozilla/layout/generic/nsBlockReflowContext.h index 58ddd2279d9..8a191e3e4cb 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.h +++ b/mozilla/layout/generic/nsBlockReflowContext.h @@ -47,7 +47,8 @@ public: mCompactMarginWidth = aCompactMarginWidth; } - nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace); + nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace, + nsReflowStatus& aReflowStatus); PRBool PlaceBlock(PRBool aForceFit, PRBool aApplyTopMargin, nscoord aPrevBottomMargin, diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index 617a9585b2f..be205900e8e 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -18,6 +18,8 @@ */ #include "nsLineBox.h" #include "nsISpaceManager.h" +#include "nsIStyleContext.h" +#include "nsLineLayout.h" #include "prprf.h" nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) @@ -273,3 +275,19 @@ nsLineBox::UnplaceFloaters(nsISpaceManager* aSpaceManager) } } } + +#ifdef NS_DEBUG +PRBool +nsLineBox::CheckIsBlock() const +{ + nsIFrame* frame = mFirstChild; + const nsStyleDisplay* display; + frame->GetStyleData(eStyleStruct_Display, + (const nsStyleStruct*&) display); + const nsStylePosition* position; + frame->GetStyleData(eStyleStruct_Position, + (const nsStyleStruct*&) position); + PRBool isBlock = nsLineLayout::TreatFrameAsBlock(display, position); + return isBlock == IsBlock(); +} +#endif diff --git a/mozilla/layout/generic/nsLineBox.h b/mozilla/layout/generic/nsLineBox.h index a39dbc065dc..cfe62feb62f 100644 --- a/mozilla/layout/generic/nsLineBox.h +++ b/mozilla/layout/generic/nsLineBox.h @@ -58,12 +58,12 @@ public: return mCarriedOutBottomMargin; } - nscoord GetCarriedOutMarginFlags() const { - return 0;/* XXX write me */ - } - nscoord GetHeight() const { return mBounds.height; } +#ifdef NS_DEBUG + PRBool CheckIsBlock() const; +#endif + //---------------------------------------------------------------------- // XXX old junk nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags); diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index e0c15a823e6..4a205d2e2a1 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -71,10 +71,10 @@ nsBlockReflowContext::ComputeMarginsFor(nsIPresContext& aPresContext, } nsresult -nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) +nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace, + nsReflowStatus& aFrameReflowStatus) { - nsReflowStatus reflowStatus; - + nsresult rv = NS_OK; mFrame = aFrame; mSpace = aSpace; @@ -127,8 +127,8 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) // Let frame know that we are reflowing it nsIHTMLReflow* htmlReflow; - nsresult rv = aFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow); - if (!NS_SUCCEEDED(rv)) { + rv = aFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow); + if (NS_FAILED(rv)) { return rv; } htmlReflow->WillReflow(mPresContext); @@ -144,7 +144,8 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) nscoord ty = y - mOuterReflowState.mBorderPadding.top; aFrame->MoveTo(x, y); mOuterReflowState.spaceManager->Translate(tx, ty); - htmlReflow->Reflow(mPresContext, mMetrics, reflowState, reflowStatus); + rv = htmlReflow->Reflow(mPresContext, mMetrics, reflowState, + aFrameReflowStatus); mOuterReflowState.spaceManager->Translate(-tx, -ty); aFrame->GetFrameState(state); @@ -163,12 +164,12 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) aFrame->SetFrameState(state & ~NS_FRAME_FIRST_REFLOW); } - if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) { + if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { // If frame is complete and has a next-in-flow, we need to delete // them now. Do not do this when a break-before is signaled because // the frame is going to get reflowed again (and may end up wanting // a next-in-flow where it ends up). - if (NS_FRAME_IS_COMPLETE(reflowStatus)) { + if (NS_FRAME_IS_COMPLETE(aFrameReflowStatus)) { nsIFrame* kidNextInFlow; aFrame->GetNextInFlow(kidNextInFlow); if (nsnull != kidNextInFlow) { @@ -183,7 +184,7 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace) } } - return reflowStatus; + return rv; } /** diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.h b/mozilla/layout/html/base/src/nsBlockReflowContext.h index 58ddd2279d9..8a191e3e4cb 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.h +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.h @@ -47,7 +47,8 @@ public: mCompactMarginWidth = aCompactMarginWidth; } - nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace); + nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace, + nsReflowStatus& aReflowStatus); PRBool PlaceBlock(PRBool aForceFit, PRBool aApplyTopMargin, nscoord aPrevBottomMargin, diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index 617a9585b2f..be205900e8e 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -18,6 +18,8 @@ */ #include "nsLineBox.h" #include "nsISpaceManager.h" +#include "nsIStyleContext.h" +#include "nsLineLayout.h" #include "prprf.h" nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) @@ -273,3 +275,19 @@ nsLineBox::UnplaceFloaters(nsISpaceManager* aSpaceManager) } } } + +#ifdef NS_DEBUG +PRBool +nsLineBox::CheckIsBlock() const +{ + nsIFrame* frame = mFirstChild; + const nsStyleDisplay* display; + frame->GetStyleData(eStyleStruct_Display, + (const nsStyleStruct*&) display); + const nsStylePosition* position; + frame->GetStyleData(eStyleStruct_Position, + (const nsStyleStruct*&) position); + PRBool isBlock = nsLineLayout::TreatFrameAsBlock(display, position); + return isBlock == IsBlock(); +} +#endif diff --git a/mozilla/layout/html/base/src/nsLineBox.h b/mozilla/layout/html/base/src/nsLineBox.h index a39dbc065dc..cfe62feb62f 100644 --- a/mozilla/layout/html/base/src/nsLineBox.h +++ b/mozilla/layout/html/base/src/nsLineBox.h @@ -58,12 +58,12 @@ public: return mCarriedOutBottomMargin; } - nscoord GetCarriedOutMarginFlags() const { - return 0;/* XXX write me */ - } - nscoord GetHeight() const { return mBounds.height; } +#ifdef NS_DEBUG + PRBool CheckIsBlock() const; +#endif + //---------------------------------------------------------------------- // XXX old junk nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags);