diff --git a/mozilla/content/shared/public/nsLayoutAtomList.h b/mozilla/content/shared/public/nsLayoutAtomList.h index 32a61bc04fc..c577ef3c640 100644 --- a/mozilla/content/shared/public/nsLayoutAtomList.h +++ b/mozilla/content/shared/public/nsLayoutAtomList.h @@ -100,6 +100,7 @@ LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content") // Alphabetical list of frame types LAYOUT_ATOM(areaFrame, "AreaFrame") LAYOUT_ATOM(blockFrame, "BlockFrame") +LAYOUT_ATOM(boxFrame, "BoxFrame") LAYOUT_ATOM(brFrame, "BRFrame") LAYOUT_ATOM(bulletFrame, "BulletFrame") LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame") @@ -132,7 +133,6 @@ LAYOUT_ATOM(textFrame, "TextFrame") LAYOUT_ATOM(viewportFrame, "ViewportFrame") // Alphabetical list of frame property names -LAYOUT_ATOM(cellPctOverHeightProperty, "CellPctOverHeightProperty") // nscoord* LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint* LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize* diff --git a/mozilla/layout/base/nsIPercentHeightObserver.h b/mozilla/layout/base/nsIPercentHeightObserver.h index e65933606b0..61c818af5a3 100644 --- a/mozilla/layout/base/nsIPercentHeightObserver.h +++ b/mozilla/layout/base/nsIPercentHeightObserver.h @@ -38,5 +38,24 @@ #ifndef nsIPercentHeightObserver_h___ #define nsIPercentHeightObserver_h___ +struct nsHTMLReflowState; +class nsIPresContext; + +// IID for the nsIPercentHeightObserver interface +#define NS_IPERCENTHEIGHTOBSERVER_IID \ + { 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}} + +/** + * This interface is supported by frames that need to provide computed height + * values to children during reflow which would otherwise not happen. Currently only + * tables support this. + */ +class nsIPercentHeightObserver : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID) + + NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0; +}; #endif // nsIPercentHeightObserver_h___ diff --git a/mozilla/layout/base/nsLayoutAtomList.h b/mozilla/layout/base/nsLayoutAtomList.h index 32a61bc04fc..c577ef3c640 100644 --- a/mozilla/layout/base/nsLayoutAtomList.h +++ b/mozilla/layout/base/nsLayoutAtomList.h @@ -100,6 +100,7 @@ LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content") // Alphabetical list of frame types LAYOUT_ATOM(areaFrame, "AreaFrame") LAYOUT_ATOM(blockFrame, "BlockFrame") +LAYOUT_ATOM(boxFrame, "BoxFrame") LAYOUT_ATOM(brFrame, "BRFrame") LAYOUT_ATOM(bulletFrame, "BulletFrame") LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame") @@ -132,7 +133,6 @@ LAYOUT_ATOM(textFrame, "TextFrame") LAYOUT_ATOM(viewportFrame, "ViewportFrame") // Alphabetical list of frame property names -LAYOUT_ATOM(cellPctOverHeightProperty, "CellPctOverHeightProperty") // nscoord* LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint* LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize* diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 42179c703f8..e49f327d01e 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -2686,7 +2686,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { @@ -2823,7 +2823,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { nsIFrameDebug* frameDebug; @@ -3366,7 +3366,7 @@ PresShell::StyleChangeReflow() nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { nsIFrameDebug* frameDebug; diff --git a/mozilla/layout/base/public/MANIFEST b/mozilla/layout/base/public/MANIFEST index afad31bf1ec..bd2d296ee0b 100644 --- a/mozilla/layout/base/public/MANIFEST +++ b/mozilla/layout/base/public/MANIFEST @@ -22,6 +22,7 @@ nsILayoutHistoryState.h nsIMutableStyleContext.h nsIObjectFrame.h nsIPageSequenceFrame.h +nsIPercentHeightObserver.h nsIPresContext.h nsIPresShell.h nsIPresState.h diff --git a/mozilla/layout/base/public/Makefile.in b/mozilla/layout/base/public/Makefile.in index 70e9847411f..8532dddbb0f 100644 --- a/mozilla/layout/base/public/Makefile.in +++ b/mozilla/layout/base/public/Makefile.in @@ -51,6 +51,7 @@ nsILayoutHistoryState.h \ nsIMutableStyleContext.h \ nsIObjectFrame.h \ nsIPageSequenceFrame.h \ +nsIPercentHeightObserver.h \ nsIPresContext.h \ nsIPresShell.h \ nsIPresState.h \ diff --git a/mozilla/layout/base/public/makefile.win b/mozilla/layout/base/public/makefile.win index a6d42cf6639..f6264df88cb 100644 --- a/mozilla/layout/base/public/makefile.win +++ b/mozilla/layout/base/public/makefile.win @@ -46,11 +46,12 @@ EXPORTS = \ nsIMutableStyleContext.h \ nsIObjectFrame.h \ nsIPageSequenceFrame.h \ + nsIPercentHeightObserver.h \ nsIPresContext.h \ nsIPresShell.h \ nsIPresState.h \ nsIPrintContext.h \ - nsIPrintPreviewContext.h \ + nsIPrintPreviewContext.h \ nsIReflowCallback.h \ nsIReflowCommand.h \ nsIScrollableFrame.h \ diff --git a/mozilla/layout/base/public/nsHTMLReflowState.h b/mozilla/layout/base/public/nsHTMLReflowState.h index 85c0d7aff11..9f722c52e4f 100644 --- a/mozilla/layout/base/public/nsHTMLReflowState.h +++ b/mozilla/layout/base/public/nsHTMLReflowState.h @@ -46,6 +46,7 @@ class nsIReflowCommand; class nsIRenderingContext; class nsSpaceManager; class nsLineLayout; +class nsIPercentHeightObserver; struct nsStyleDisplay; struct nsStyleVisibility; @@ -153,9 +154,6 @@ struct nsHTMLReflowState { // rendering context to use for measurement nsIRenderingContext* rendContext; - // is the current context at the top of a page? - PRPackedBool isTopOfPage; - // The type of frame, from css's perspective. This value is // initialized by the Init method below. nsCSSFrameType mFrameType; @@ -214,38 +212,29 @@ struct nsHTMLReflowState { // Compact margin available space nscoord mCompactMarginWidth; - // The following data members are relevant if nsStyleText.mTextAlign - // == NS_STYLE_TEXT_ALIGN_CHAR - - // distance from reference edge (as specified in nsStyleDisplay.mDirection) - // to the align character (which will be specified in nsStyleTable) - nscoord mAlignCharOffset; - - // if true, the reflow honors alignCharOffset and does not - // set it. if false, the reflow sets alignCharOffset - PRPackedBool mUseAlignCharOffset; - - // Keep track of text-decoration: blink - PRPackedBool mBlinks; - // Cached pointers to the various style structs used during intialization - const nsStyleDisplay* mStyleDisplay; + const nsStyleDisplay* mStyleDisplay; const nsStyleVisibility* mStyleVisibility; - const nsStylePosition* mStylePosition; - const nsStyleBorder* mStyleBorder; - const nsStyleMargin* mStyleMargin; - const nsStylePadding* mStylePadding; - const nsStyleText* mStyleText; + const nsStylePosition* mStylePosition; + const nsStyleBorder* mStyleBorder; + const nsStyleMargin* mStyleMargin; + const nsStylePadding* mStylePadding; + const nsStyleText* mStyleText; + + // a frame (e.g. nsTableCellFrame) which may need to generate a special + // reflow for percent height calculations + nsIPercentHeightObserver* mPercentHeightObserver; // This value keeps track of how deeply nested a given reflow state // is from the top of the frame tree. PRInt16 mReflowDepth; struct ReflowStateFlags { - //unsigned mUseAlignCharOffset:1; // ditto - //unsigned isTopOfPage:1; // ditto - PRUint16 mSpecialTableReflow:1; // used by tables to communicate special reflow in process - PRUint16 mUnused:15; + PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle + // percent height frames inside cells which may not have computed heights + PRUint16 mIsTopOfPage:1; // is the current context at the top of a page? + PRUint16 mBlinks:1; // Keep track of text-decoration: blink + PRUint16 mUnused:13; // for future use } mFlags; #ifdef IBMBIDI diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 0801d8d0cef..2eb7b275e00 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -80,6 +80,7 @@ class nsIView; class nsIWidget; class nsIDOMRange; class nsISelectionController; +class nsIPercentHeightObserver; #ifdef ACCESSIBILITY class nsIAccessible; #endif @@ -908,8 +909,9 @@ public: * XXX Don't we want the semantics to dictate that we only call this once for * a given reflow? */ - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) = 0; + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) = 0; // XXX Maybe these three should be a separate interface? diff --git a/mozilla/layout/base/public/nsIPercentHeightObserver.h b/mozilla/layout/base/public/nsIPercentHeightObserver.h index e65933606b0..61c818af5a3 100644 --- a/mozilla/layout/base/public/nsIPercentHeightObserver.h +++ b/mozilla/layout/base/public/nsIPercentHeightObserver.h @@ -38,5 +38,24 @@ #ifndef nsIPercentHeightObserver_h___ #define nsIPercentHeightObserver_h___ +struct nsHTMLReflowState; +class nsIPresContext; + +// IID for the nsIPercentHeightObserver interface +#define NS_IPERCENTHEIGHTOBSERVER_IID \ + { 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}} + +/** + * This interface is supported by frames that need to provide computed height + * values to children during reflow which would otherwise not happen. Currently only + * tables support this. + */ +class nsIPercentHeightObserver : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID) + + NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0; +}; #endif // nsIPercentHeightObserver_h___ diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index e1d37b12c01..1fd9b2705e0 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -672,7 +672,8 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus); // Set the child's width and height to it's desired size - FinishReflowChild(aFrame, aPresContext, aDesiredSize, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY); + FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize, + rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY); return rv; } diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index 5d6c9c4920e..fb62b36a760 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -425,7 +425,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, availSize.width = mLegendRect.width; } - FinishReflowChild(mLegendFrame, aPresContext, legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME); + FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState, + legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME); } } @@ -480,7 +481,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace); } - FinishReflowChild(mContentFrame, aPresContext, kidDesiredSize, contentRect.x, contentRect.y, 0); + FinishReflowChild(mContentFrame, aPresContext, &kidReflowState, + kidDesiredSize, contentRect.x, contentRect.y, 0); nsFrameState kidState; mContentFrame->GetFrameState(&kidState); diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 656768a4a3f..abc81b00765 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -400,7 +400,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus status; rv = mTextFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status); if (NS_FAILED(rv)) return rv; - rv = mTextFrame->DidReflow(aPresContext, aStatus); + rv = mTextFrame->DidReflow(aPresContext, &txtKidReflowState, aStatus); if (NS_FAILED(rv)) return rv; // now adjust the frame positions diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 6f1a3bb2432..479e18be280 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -501,10 +501,11 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsFormControlFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsFormControlFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsLeafFrame::DidReflow(aPresContext, aReflowState, aStatus); // The view is created hidden; once we have reflowed it and it has been diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index 7c63f312071..cded9948a68 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -126,8 +126,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); /** * Respond to the request to resize and/or reflow diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 58e47067006..9e8de8f8c41 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -637,7 +637,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext, } // Place the child - FinishReflowChild(firstKid, aPresContext, aDesiredSize, + FinishReflowChild(firstKid, aPresContext, &reflowState, aDesiredSize, focusPadding.left + aReflowState.mComputedBorderPadding.right, yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0); diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index c270d385bd8..a17f072cde5 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -2411,19 +2411,20 @@ nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext, //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsListControlFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { if (PR_TRUE == IsInDropDownMode()) { //SyncViewWithFrame(); mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; - nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; SyncViewWithFrame(aPresContext); return rv; } else { - nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus); PRInt32 selectedIndex = mEndSelectionIndex; if (selectedIndex == kNothingSelected) { GetSelectedIndex(&selectedIndex); diff --git a/mozilla/layout/forms/nsListControlFrame.h b/mozilla/layout/forms/nsListControlFrame.h index 5a6abd3ec57..438489fa8d2 100644 --- a/mozilla/layout/forms/nsListControlFrame.h +++ b/mozilla/layout/forms/nsListControlFrame.h @@ -206,7 +206,9 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY); NS_IMETHOD Destroy(nsIPresContext *aPresContext); diff --git a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp index 897e1906b44..a64bae38e11 100644 --- a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp @@ -477,7 +477,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat aKidFrame->GetView(aPresContext, &kidView); nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView, &kidDesiredSize.mOverflowArea); - aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); // If the frame has visible overflow, then store it as a property on the // frame. This allows us to be able to recover it without having to reflow diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 4193a3491f4..52cd792cf75 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -3211,9 +3211,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, PRBool isAdjacentWithTop = aState.IsAdjacentWithTop(); nsCollapsingMargin collapsedBottomMargin; nsRect combinedArea(0,0,0,0); - *aKeepReflowGoing = brc.PlaceBlock(isAdjacentWithTop, computedOffsets, - collapsedBottomMargin, - aLine->mBounds, combinedArea); + *aKeepReflowGoing = brc.PlaceBlock(aState.mReflowState, isAdjacentWithTop, computedOffsets, + collapsedBottomMargin, aLine->mBounds, combinedArea); aLine->SetCarriedOutBottomMargin(collapsedBottomMargin); if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) { @@ -5153,7 +5152,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, &metrics.mOverflowArea, NS_FRAME_NO_MOVE_VIEW); } - floater->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED); + floater->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED); // If we computed it, then stash away the max-element-size for later if (computeMaxElementSize) { @@ -6300,7 +6299,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); - mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED); + mBullet->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 2839b6917d7..b98d72f20fa 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -432,7 +432,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, aComputedOffsets = aReflowState.mComputedOffsets; aReflowState.mLineLayout = nsnull; if (!aIsAdjacentWithTop) { - aReflowState.isTopOfPage = PR_FALSE; // make sure this is cleared + aReflowState.mFlags.mIsTopOfPage = PR_FALSE; // make sure this is cleared } mIsTable = NS_STYLE_DISPLAY_TABLE == aReflowState.mStyleDisplay->mDisplay; mComputedWidth = aReflowState.mComputedWidth; @@ -688,11 +688,12 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, * margins (CSS2 8.3.1). Also apply relative positioning. */ PRBool -nsBlockReflowContext::PlaceBlock(PRBool aForceFit, - const nsMargin& aComputedOffsets, - nsCollapsingMargin& aBottomMarginResult, - nsRect& aInFlowBounds, - nsRect& aCombinedRect) +nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState, + PRBool aForceFit, + const nsMargin& aComputedOffsets, + nsCollapsingMargin& aBottomMarginResult, + nsRect& aInFlowBounds, + nsRect& aCombinedRect) { // Compute collapsed bottom margin value aBottomMarginResult = mMetrics.mCarriedOutBottomMargin; @@ -731,7 +732,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, nsRect r(x, y, mMetrics.width, 0); // Now place the frame and complete the reflow process - nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0); + nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0); aInFlowBounds = r; // Retain combined area information in case we contain a floater @@ -781,7 +782,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, } // Now place the frame and complete the reflow process - nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0); + nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0); // Adjust the max-element-size in the metrics to take into // account the margins around the block element. Note that we @@ -817,7 +818,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, else { // Send the DidReflow() notification, but don't bother placing // the frame - mFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + mFrame->DidReflow(mPresContext, &aReflowState, NS_FRAME_REFLOW_FINISHED); fits = PR_FALSE; } } diff --git a/mozilla/layout/generic/nsBlockReflowContext.h b/mozilla/layout/generic/nsBlockReflowContext.h index 30422ec4b03..0cca2f50f88 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.h +++ b/mozilla/layout/generic/nsBlockReflowContext.h @@ -76,11 +76,12 @@ public: nsMargin& aComputedOffsets, nsReflowStatus& aReflowStatus); - PRBool PlaceBlock(PRBool aForceFit, - const nsMargin& aComputedOffsets, - nsCollapsingMargin& aBottomMarginResult /* out */, - nsRect& aInFlowBounds, - nsRect& aCombinedRect); + PRBool PlaceBlock(const nsHTMLReflowState& aReflowState, + PRBool aForceFit, + const nsMargin& aComputedOffsets, + nsCollapsingMargin& aBottomMarginResult /* out */, + nsRect& aInFlowBounds, + nsRect& aCombinedRect); void AlignBlockHorizontally(nscoord aWidth, nsBlockHorizontalAlign&); diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 65ed99819db..d19e5a70330 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -834,12 +834,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, * NS_FRAME_NO_SIZE_VIEW - don't size the frame's view */ nsresult -nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - nscoord aX, - nscoord aY, - PRUint32 aFlags) +nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, + nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsHTMLReflowMetrics& aDesiredSize, + nscoord aX, + nscoord aY, + PRUint32 aFlags) { nsPoint curOrigin; nsRect bounds(aX, aY, aDesiredSize.width, aDesiredSize.height); @@ -863,7 +864,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, PositionChildViews(aPresContext, aKidFrame); } - return aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED); } /** diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index 1edbeefd1df..c398fdbb8cc 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -156,12 +156,13 @@ public: * don't want to automatically sync the frame and view * NS_FRAME_NO_SIZE_VIEW - don't size the frame's view */ - static nsresult FinishReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - nscoord aX, - nscoord aY, - PRUint32 aFlags); + static nsresult FinishReflowChild(nsIFrame* aKidFrame, + nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsHTMLReflowMetrics& aDesiredSize, + nscoord aX, + nscoord aY, + PRUint32 aFlags); static void PositionChildViews(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index e9be5b6b262..50d020be474 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -269,7 +269,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext, // Place and size the child and update the output metrics kid->MoveTo(aPresContext, bp.left, bp.top); kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height); - kid->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); aMetrics.width += lr; aMetrics.height += tb; aMetrics.ascent += bp.top; diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index db3c1a3f484..916b6212821 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -84,6 +84,7 @@ #include "nsITableCellLayout.h"// " #include "nsIGfxTextControlFrame.h" #include "nsINameSpaceManager.h" +#include "nsIPercentHeightObserver.h" // For triple-click pref #include "nsIPref.h" @@ -1767,8 +1768,9 @@ nsFrame::WillReflow(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, ("nsFrame::DidReflow: aStatus=%d", aStatus)); @@ -1777,6 +1779,22 @@ nsFrame::DidReflow(nsIPresContext* aPresContext, NS_FRAME_HAS_DIRTY_CHILDREN); } + // Notify the percent height observer if this is an initial or resize constrained reflow + // and there is a percent height but no computed height. The observer may be able to + // initiate another reflow with a computed height. This happens in the case where a table + // cell has no computed height but can fabricate one when the cell height is known. + if (aReflowState && (aReflowState->mPercentHeightObserver) && // an observer + ((eReflowReason_Initial == aReflowState->reason) || // initial or resize reflow + (eReflowReason_Resize == aReflowState->reason)) && + (NS_UNCONSTRAINEDSIZE != aReflowState->availableWidth) && // constrained width reflow + ((NS_UNCONSTRAINEDSIZE == aReflowState->mComputedHeight) || // no computed height + (0 == aReflowState->mComputedHeight)) && + aReflowState->mStylePosition && // percent height + (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) { + + aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState); + } + return NS_OK; } diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index c2e58cf8ed9..de0cab5899b 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -301,8 +301,9 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const; NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace); NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 9f010109d7d..e279839a7bf 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -238,8 +238,9 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent, @@ -532,7 +533,8 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext, } // Place and size the child - FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0); + FinishReflowChild(firstChild, aPresContext, nsnull, + kidMetrics, offset.x, offset.y, 0); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x", @@ -962,10 +964,11 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent*& aContent) } NS_IMETHODIMP -nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsLeafFrame::DidReflow(aPresContext, nsnull, aStatus); // The view is created hidden; once we have reflowed it and it has been diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index d3649cb6ca5..d0ca0ce9664 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -1013,7 +1013,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, // Place and size the child metrics.width = aSize.width; metrics.height = aSize.height; - FinishReflowChild(aChild, aPresContext, metrics, aOffset.x, aOffset.y, 0); + FinishReflowChild(aChild, aPresContext, nsnull, metrics, aOffset.x, aOffset.y, 0); } static diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 6b67d961175..1a0f1111389 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -603,7 +603,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, // Complete the reflow and position and size the child frame nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, rect.x, rect.y, 0); + FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0); // If the child frame was just inserted, then we're responsible for making sure // it repaints diff --git a/mozilla/layout/generic/nsHTMLReflowCommand.cpp b/mozilla/layout/generic/nsHTMLReflowCommand.cpp index 19d62790076..cf8a8705255 100644 --- a/mozilla/layout/generic/nsHTMLReflowCommand.cpp +++ b/mozilla/layout/generic/nsHTMLReflowCommand.cpp @@ -223,7 +223,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext* aPresContext, nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, root, view, nsnull); } - root->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + root->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } return NS_OK; diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 278c2fd254f..bd7a053f0cf 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -86,7 +86,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, : mReflowDepth(0) { NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context"); - mFlags.mSpecialTableReflow = mFlags.mUnused = 0; + mFlags.mSpecialHeightReflow = mFlags.mUnused = 0; parentReflowState = nsnull; frame = aFrame; reason = aReason; @@ -96,7 +96,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aRenderingContext; mSpaceManager = nsnull; mLineLayout = nsnull; - isTopOfPage = PR_FALSE; + mFlags.mIsTopOfPage = PR_FALSE; + mPercentHeightObserver = nsnull; Init(aPresContext); #ifdef IBMBIDI mRightEdge = NS_UNCONSTRAINEDSIZE; @@ -114,7 +115,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, { NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context"); - mFlags.mSpecialTableReflow = mFlags.mUnused = 0; + mFlags.mSpecialHeightReflow = mFlags.mUnused = 0; reason = eReflowReason_Incremental; parentReflowState = nsnull; frame = aFrame; @@ -124,7 +125,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aRenderingContext; mSpaceManager = nsnull; mLineLayout = nsnull; - isTopOfPage = PR_FALSE; + mFlags.mIsTopOfPage = PR_FALSE; + mPercentHeightObserver = nsnull; Init(aPresContext); #ifdef IBMBIDI mRightEdge = NS_UNCONSTRAINEDSIZE; @@ -154,7 +156,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext); @@ -182,7 +185,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext); @@ -211,7 +215,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight); @@ -226,8 +231,6 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext, nscoord aContainingBlockHeight) { mCompactMarginWidth = 0; - mAlignCharOffset = 0; - mUseAlignCharOffset = 0; #ifdef DEBUG mDebugHook = nsnull; #endif @@ -1871,12 +1874,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } } // Check for blinking text and permission to display it - mBlinks = (parentReflowState && parentReflowState->mBlinks); - if (!mBlinks && BlinkIsAllowed()) { + mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks); + if (!mFlags.mBlinks && BlinkIsAllowed()) { const nsStyleTextReset* st; frame->GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)st); - mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); + mFlags.mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); } } diff --git a/mozilla/layout/generic/nsHTMLReflowState.h b/mozilla/layout/generic/nsHTMLReflowState.h index 85c0d7aff11..9f722c52e4f 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.h +++ b/mozilla/layout/generic/nsHTMLReflowState.h @@ -46,6 +46,7 @@ class nsIReflowCommand; class nsIRenderingContext; class nsSpaceManager; class nsLineLayout; +class nsIPercentHeightObserver; struct nsStyleDisplay; struct nsStyleVisibility; @@ -153,9 +154,6 @@ struct nsHTMLReflowState { // rendering context to use for measurement nsIRenderingContext* rendContext; - // is the current context at the top of a page? - PRPackedBool isTopOfPage; - // The type of frame, from css's perspective. This value is // initialized by the Init method below. nsCSSFrameType mFrameType; @@ -214,38 +212,29 @@ struct nsHTMLReflowState { // Compact margin available space nscoord mCompactMarginWidth; - // The following data members are relevant if nsStyleText.mTextAlign - // == NS_STYLE_TEXT_ALIGN_CHAR - - // distance from reference edge (as specified in nsStyleDisplay.mDirection) - // to the align character (which will be specified in nsStyleTable) - nscoord mAlignCharOffset; - - // if true, the reflow honors alignCharOffset and does not - // set it. if false, the reflow sets alignCharOffset - PRPackedBool mUseAlignCharOffset; - - // Keep track of text-decoration: blink - PRPackedBool mBlinks; - // Cached pointers to the various style structs used during intialization - const nsStyleDisplay* mStyleDisplay; + const nsStyleDisplay* mStyleDisplay; const nsStyleVisibility* mStyleVisibility; - const nsStylePosition* mStylePosition; - const nsStyleBorder* mStyleBorder; - const nsStyleMargin* mStyleMargin; - const nsStylePadding* mStylePadding; - const nsStyleText* mStyleText; + const nsStylePosition* mStylePosition; + const nsStyleBorder* mStyleBorder; + const nsStyleMargin* mStyleMargin; + const nsStylePadding* mStylePadding; + const nsStyleText* mStyleText; + + // a frame (e.g. nsTableCellFrame) which may need to generate a special + // reflow for percent height calculations + nsIPercentHeightObserver* mPercentHeightObserver; // This value keeps track of how deeply nested a given reflow state // is from the top of the frame tree. PRInt16 mReflowDepth; struct ReflowStateFlags { - //unsigned mUseAlignCharOffset:1; // ditto - //unsigned isTopOfPage:1; // ditto - PRUint16 mSpecialTableReflow:1; // used by tables to communicate special reflow in process - PRUint16 mUnused:15; + PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle + // percent height frames inside cells which may not have computed heights + PRUint16 mIsTopOfPage:1; // is the current context at the top of a page? + PRUint16 mBlinks:1; // Keep track of text-decoration: blink + PRUint16 mUnused:13; // for future use } mFlags; #ifdef IBMBIDI diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 0801d8d0cef..2eb7b275e00 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -80,6 +80,7 @@ class nsIView; class nsIWidget; class nsIDOMRange; class nsISelectionController; +class nsIPercentHeightObserver; #ifdef ACCESSIBILITY class nsIAccessible; #endif @@ -908,8 +909,9 @@ public: * XXX Don't we want the semantics to dictate that we only call this once for * a given reflow? */ - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) = 0; + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) = 0; // XXX Maybe these three should be a separate interface? diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index b252dac1d3d..a7600774f7f 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -948,7 +948,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, psd->mReflowState->availableHeight); reflowState.reason = reason; reflowState.mLineLayout = this; - reflowState.isTopOfPage = GetFlag(LL_ISTOPOFPAGE); + reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); mTextJustificationNumSpaces = 0; @@ -1273,7 +1273,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } // Tell the frame that we're done reflowing it - aFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + aFrame->DidReflow(mPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); if (aMetrics) { *aMetrics = metrics; diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 19c0adce17c..b6f0954977a 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -1374,7 +1374,7 @@ nsObjectFrame::HandleChild(nsIPresContext* aPresContext, } ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, 0, 0, 0, status); - FinishReflowChild(child, aPresContext, kidDesiredSize, 0, 0, 0); + FinishReflowChild(child, aPresContext, &kidReflowState, kidDesiredSize, 0, 0, 0); aMetrics.width = kidDesiredSize.width; aMetrics.height = kidDesiredSize.height; @@ -1465,10 +1465,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsObjectFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsObjectFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aStatus); + nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aReflowState, aStatus); // The view is created hidden; once we have reflowed it and it has been // positioned then we show it. @@ -1708,7 +1709,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, nsCOMPtr screenPcx; shell->GetPresContext(getter_AddRefs(screenPcx)); nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status? - frame->DidReflow(screenPcx, status); // DidReflow will take care of it + frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it return rv; // done with printing } diff --git a/mozilla/layout/generic/nsObjectFrame.h b/mozilla/layout/generic/nsObjectFrame.h index cfbdc9cc02c..4b0225c469c 100644 --- a/mozilla/layout/generic/nsObjectFrame.h +++ b/mozilla/layout/generic/nsObjectFrame.h @@ -66,8 +66,9 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 23d3e8c4486..8ea14950de6 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -183,7 +183,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, nsSize maxSize(mPD->mReflowRect.width - mPD->mReflowMargin.right - mPD->mReflowMargin.left, mPD->mReflowRect.height - mPD->mReflowMargin.top - mPD->mReflowMargin.bottom); nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize); - kidReflowState.isTopOfPage = PR_TRUE; + kidReflowState.mFlags.mIsTopOfPage = PR_TRUE; kidReflowState.availableWidth = maxSize.width; kidReflowState.availableHeight = maxSize.height; @@ -196,7 +196,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, // Place and size the child - FinishReflowChild(frame, aPresContext, aDesiredSize, xc, yc, 0); + FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, xc, yc, 0); // Make sure the child is at least as tall as our max size (the containing window) if (aDesiredSize.height < aReflowState.availableHeight) { diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 83c5f6f11a7..5d64b45cb36 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -391,7 +391,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, // max width then center it horizontally ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status); - FinishReflowChild(kidFrame, aPresContext, kidSize, x, y, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0); y += kidSize.height; // Leave a slight gap between the pages diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index fe002f3192c..370ddd2807c 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -5050,7 +5050,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // the TEXT_BLINK_ON bit). PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS); mState &= ~TEXT_REFLOW_FLAGS; - if (aReflowState.mBlinks) { + if (aReflowState.mFlags.mBlinks) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; nsBlinkTimer::AddBlinkFrame(aPresContext, this); diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index 0cde308b3da..139477afe9d 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -417,7 +417,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext, aKidFrame->GetView(aPresContext, &kidView); nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView, &kidDesiredSize.mOverflowArea); - aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aKidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); return rv; } @@ -576,7 +576,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext, kidRect.width = kidDesiredSize.width; kidRect.height = kidDesiredSize.height; - FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0); } // If it's a 'initial', 'resize', or 'style change' reflow command (anything diff --git a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp index 897e1906b44..a64bae38e11 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp @@ -477,7 +477,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat aKidFrame->GetView(aPresContext, &kidView); nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView, &kidDesiredSize.mOverflowArea); - aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); // If the frame has visible overflow, then store it as a property on the // frame. This allows us to be able to recover it without having to reflow diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 4193a3491f4..52cd792cf75 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -3211,9 +3211,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, PRBool isAdjacentWithTop = aState.IsAdjacentWithTop(); nsCollapsingMargin collapsedBottomMargin; nsRect combinedArea(0,0,0,0); - *aKeepReflowGoing = brc.PlaceBlock(isAdjacentWithTop, computedOffsets, - collapsedBottomMargin, - aLine->mBounds, combinedArea); + *aKeepReflowGoing = brc.PlaceBlock(aState.mReflowState, isAdjacentWithTop, computedOffsets, + collapsedBottomMargin, aLine->mBounds, combinedArea); aLine->SetCarriedOutBottomMargin(collapsedBottomMargin); if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) { @@ -5153,7 +5152,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, &metrics.mOverflowArea, NS_FRAME_NO_MOVE_VIEW); } - floater->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED); + floater->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED); // If we computed it, then stash away the max-element-size for later if (computeMaxElementSize) { @@ -6300,7 +6299,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); - mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED); + mBullet->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index 2839b6917d7..b98d72f20fa 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -432,7 +432,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, aComputedOffsets = aReflowState.mComputedOffsets; aReflowState.mLineLayout = nsnull; if (!aIsAdjacentWithTop) { - aReflowState.isTopOfPage = PR_FALSE; // make sure this is cleared + aReflowState.mFlags.mIsTopOfPage = PR_FALSE; // make sure this is cleared } mIsTable = NS_STYLE_DISPLAY_TABLE == aReflowState.mStyleDisplay->mDisplay; mComputedWidth = aReflowState.mComputedWidth; @@ -688,11 +688,12 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, * margins (CSS2 8.3.1). Also apply relative positioning. */ PRBool -nsBlockReflowContext::PlaceBlock(PRBool aForceFit, - const nsMargin& aComputedOffsets, - nsCollapsingMargin& aBottomMarginResult, - nsRect& aInFlowBounds, - nsRect& aCombinedRect) +nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState, + PRBool aForceFit, + const nsMargin& aComputedOffsets, + nsCollapsingMargin& aBottomMarginResult, + nsRect& aInFlowBounds, + nsRect& aCombinedRect) { // Compute collapsed bottom margin value aBottomMarginResult = mMetrics.mCarriedOutBottomMargin; @@ -731,7 +732,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, nsRect r(x, y, mMetrics.width, 0); // Now place the frame and complete the reflow process - nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0); + nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0); aInFlowBounds = r; // Retain combined area information in case we contain a floater @@ -781,7 +782,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, } // Now place the frame and complete the reflow process - nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0); + nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0); // Adjust the max-element-size in the metrics to take into // account the margins around the block element. Note that we @@ -817,7 +818,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, else { // Send the DidReflow() notification, but don't bother placing // the frame - mFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + mFrame->DidReflow(mPresContext, &aReflowState, NS_FRAME_REFLOW_FINISHED); fits = PR_FALSE; } } diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.h b/mozilla/layout/html/base/src/nsBlockReflowContext.h index 30422ec4b03..0cca2f50f88 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.h +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.h @@ -76,11 +76,12 @@ public: nsMargin& aComputedOffsets, nsReflowStatus& aReflowStatus); - PRBool PlaceBlock(PRBool aForceFit, - const nsMargin& aComputedOffsets, - nsCollapsingMargin& aBottomMarginResult /* out */, - nsRect& aInFlowBounds, - nsRect& aCombinedRect); + PRBool PlaceBlock(const nsHTMLReflowState& aReflowState, + PRBool aForceFit, + const nsMargin& aComputedOffsets, + nsCollapsingMargin& aBottomMarginResult /* out */, + nsRect& aInFlowBounds, + nsRect& aCombinedRect); void AlignBlockHorizontally(nscoord aWidth, nsBlockHorizontalAlign&); diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 65ed99819db..d19e5a70330 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -834,12 +834,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, * NS_FRAME_NO_SIZE_VIEW - don't size the frame's view */ nsresult -nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - nscoord aX, - nscoord aY, - PRUint32 aFlags) +nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, + nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsHTMLReflowMetrics& aDesiredSize, + nscoord aX, + nscoord aY, + PRUint32 aFlags) { nsPoint curOrigin; nsRect bounds(aX, aY, aDesiredSize.width, aDesiredSize.height); @@ -863,7 +864,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame, PositionChildViews(aPresContext, aKidFrame); } - return aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED); } /** diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index 1edbeefd1df..c398fdbb8cc 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -156,12 +156,13 @@ public: * don't want to automatically sync the frame and view * NS_FRAME_NO_SIZE_VIEW - don't size the frame's view */ - static nsresult FinishReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - nscoord aX, - nscoord aY, - PRUint32 aFlags); + static nsresult FinishReflowChild(nsIFrame* aKidFrame, + nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsHTMLReflowMetrics& aDesiredSize, + nscoord aX, + nscoord aY, + PRUint32 aFlags); static void PositionChildViews(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index e9be5b6b262..50d020be474 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -269,7 +269,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext, // Place and size the child and update the output metrics kid->MoveTo(aPresContext, bp.left, bp.top); kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height); - kid->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); aMetrics.width += lr; aMetrics.height += tb; aMetrics.ascent += bp.top; diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index db3c1a3f484..916b6212821 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -84,6 +84,7 @@ #include "nsITableCellLayout.h"// " #include "nsIGfxTextControlFrame.h" #include "nsINameSpaceManager.h" +#include "nsIPercentHeightObserver.h" // For triple-click pref #include "nsIPref.h" @@ -1767,8 +1768,9 @@ nsFrame::WillReflow(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, ("nsFrame::DidReflow: aStatus=%d", aStatus)); @@ -1777,6 +1779,22 @@ nsFrame::DidReflow(nsIPresContext* aPresContext, NS_FRAME_HAS_DIRTY_CHILDREN); } + // Notify the percent height observer if this is an initial or resize constrained reflow + // and there is a percent height but no computed height. The observer may be able to + // initiate another reflow with a computed height. This happens in the case where a table + // cell has no computed height but can fabricate one when the cell height is known. + if (aReflowState && (aReflowState->mPercentHeightObserver) && // an observer + ((eReflowReason_Initial == aReflowState->reason) || // initial or resize reflow + (eReflowReason_Resize == aReflowState->reason)) && + (NS_UNCONSTRAINEDSIZE != aReflowState->availableWidth) && // constrained width reflow + ((NS_UNCONSTRAINEDSIZE == aReflowState->mComputedHeight) || // no computed height + (0 == aReflowState->mComputedHeight)) && + aReflowState->mStylePosition && // percent height + (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) { + + aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState); + } + return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index c2e58cf8ed9..de0cab5899b 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -301,8 +301,9 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const; NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace); NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 6b67d961175..1a0f1111389 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -603,7 +603,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext, // Complete the reflow and position and size the child frame nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, rect.x, rect.y, 0); + FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0); // If the child frame was just inserted, then we're responsible for making sure // it repaints diff --git a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp index 19d62790076..cf8a8705255 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp @@ -223,7 +223,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext* aPresContext, nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, root, view, nsnull); } - root->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + root->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } return NS_OK; diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 278c2fd254f..bd7a053f0cf 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -86,7 +86,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, : mReflowDepth(0) { NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context"); - mFlags.mSpecialTableReflow = mFlags.mUnused = 0; + mFlags.mSpecialHeightReflow = mFlags.mUnused = 0; parentReflowState = nsnull; frame = aFrame; reason = aReason; @@ -96,7 +96,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aRenderingContext; mSpaceManager = nsnull; mLineLayout = nsnull; - isTopOfPage = PR_FALSE; + mFlags.mIsTopOfPage = PR_FALSE; + mPercentHeightObserver = nsnull; Init(aPresContext); #ifdef IBMBIDI mRightEdge = NS_UNCONSTRAINEDSIZE; @@ -114,7 +115,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, { NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context"); - mFlags.mSpecialTableReflow = mFlags.mUnused = 0; + mFlags.mSpecialHeightReflow = mFlags.mUnused = 0; reason = eReflowReason_Incremental; parentReflowState = nsnull; frame = aFrame; @@ -124,7 +125,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aRenderingContext; mSpaceManager = nsnull; mLineLayout = nsnull; - isTopOfPage = PR_FALSE; + mFlags.mIsTopOfPage = PR_FALSE; + mPercentHeightObserver = nsnull; Init(aPresContext); #ifdef IBMBIDI mRightEdge = NS_UNCONSTRAINEDSIZE; @@ -154,7 +156,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext); @@ -182,7 +185,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext); @@ -211,7 +215,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext, rendContext = aParentReflowState.rendContext; mSpaceManager = aParentReflowState.mSpaceManager; mLineLayout = aParentReflowState.mLineLayout; - isTopOfPage = aParentReflowState.isTopOfPage; + mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage; + mPercentHeightObserver = aParentReflowState.mPercentHeightObserver; Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight); @@ -226,8 +231,6 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext, nscoord aContainingBlockHeight) { mCompactMarginWidth = 0; - mAlignCharOffset = 0; - mUseAlignCharOffset = 0; #ifdef DEBUG mDebugHook = nsnull; #endif @@ -1871,12 +1874,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } } // Check for blinking text and permission to display it - mBlinks = (parentReflowState && parentReflowState->mBlinks); - if (!mBlinks && BlinkIsAllowed()) { + mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks); + if (!mFlags.mBlinks && BlinkIsAllowed()) { const nsStyleTextReset* st; frame->GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)st); - mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); + mFlags.mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); } } diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index b252dac1d3d..a7600774f7f 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -948,7 +948,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, psd->mReflowState->availableHeight); reflowState.reason = reason; reflowState.mLineLayout = this; - reflowState.isTopOfPage = GetFlag(LL_ISTOPOFPAGE); + reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); mTextJustificationNumSpaces = 0; @@ -1273,7 +1273,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } // Tell the frame that we're done reflowing it - aFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + aFrame->DidReflow(mPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); if (aMetrics) { *aMetrics = metrics; diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index 19c0adce17c..b6f0954977a 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -1374,7 +1374,7 @@ nsObjectFrame::HandleChild(nsIPresContext* aPresContext, } ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, 0, 0, 0, status); - FinishReflowChild(child, aPresContext, kidDesiredSize, 0, 0, 0); + FinishReflowChild(child, aPresContext, &kidReflowState, kidDesiredSize, 0, 0, 0); aMetrics.width = kidDesiredSize.width; aMetrics.height = kidDesiredSize.height; @@ -1465,10 +1465,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsObjectFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsObjectFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aStatus); + nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aReflowState, aStatus); // The view is created hidden; once we have reflowed it and it has been // positioned then we show it. @@ -1708,7 +1709,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, nsCOMPtr screenPcx; shell->GetPresContext(getter_AddRefs(screenPcx)); nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status? - frame->DidReflow(screenPcx, status); // DidReflow will take care of it + frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it return rv; // done with printing } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.h b/mozilla/layout/html/base/src/nsObjectFrame.h index cfbdc9cc02c..4b0225c469c 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.h +++ b/mozilla/layout/html/base/src/nsObjectFrame.h @@ -66,8 +66,9 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 23d3e8c4486..8ea14950de6 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -183,7 +183,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, nsSize maxSize(mPD->mReflowRect.width - mPD->mReflowMargin.right - mPD->mReflowMargin.left, mPD->mReflowRect.height - mPD->mReflowMargin.top - mPD->mReflowMargin.bottom); nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize); - kidReflowState.isTopOfPage = PR_TRUE; + kidReflowState.mFlags.mIsTopOfPage = PR_TRUE; kidReflowState.availableWidth = maxSize.width; kidReflowState.availableHeight = maxSize.height; @@ -196,7 +196,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, // Place and size the child - FinishReflowChild(frame, aPresContext, aDesiredSize, xc, yc, 0); + FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, xc, yc, 0); // Make sure the child is at least as tall as our max size (the containing window) if (aDesiredSize.height < aReflowState.availableHeight) { diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 42179c703f8..e49f327d01e 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -2686,7 +2686,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { @@ -2823,7 +2823,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { nsIFrameDebug* frameDebug; @@ -3366,7 +3366,7 @@ PresShell::StyleChangeReflow() nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view, nsnull); } - rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED); + rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); #ifdef NS_DEBUG if (nsIFrameDebug::GetVerifyTreeEnable()) { nsIFrameDebug* frameDebug; diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index ca08d38225e..83b4b864582 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -352,15 +352,16 @@ nsScrollFrame::RemoveFrame(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsScrollFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsScrollFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { nsresult rv = NS_OK; if (NS_FRAME_REFLOW_FINISHED == aStatus) { // Let the default nsFrame implementation clear the state flags // and size and position our view - rv = nsFrame::DidReflow(aPresContext, aStatus); + rv = nsFrame::DidReflow(aPresContext, aReflowState, aStatus); // Have the scrolling view layout nsIScrollableView* scrollingView; @@ -939,8 +940,8 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext, } // Place and size the child. - FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, border.left, - border.top, NS_FRAME_NO_MOVE_VIEW); + FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, + border.left, border.top, NS_FRAME_NO_MOVE_VIEW); // Compute our desired size aDesiredSize.width = scrollAreaSize.width; diff --git a/mozilla/layout/html/base/src/nsScrollFrame.h b/mozilla/layout/html/base/src/nsScrollFrame.h index bf20027bdb2..34494218cae 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.h +++ b/mozilla/layout/html/base/src/nsScrollFrame.h @@ -88,8 +88,9 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 83c5f6f11a7..5d64b45cb36 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -391,7 +391,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, // max width then center it horizontally ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status); - FinishReflowChild(kidFrame, aPresContext, kidSize, x, y, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0); y += kidSize.height; // Leave a slight gap between the pages diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index fe002f3192c..370ddd2807c 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -5050,7 +5050,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // the TEXT_BLINK_ON bit). PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS); mState &= ~TEXT_REFLOW_FLAGS; - if (aReflowState.mBlinks) { + if (aReflowState.mFlags.mBlinks) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; nsBlinkTimer::AddBlinkFrame(aPresContext, this); diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index 0cde308b3da..139477afe9d 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -417,7 +417,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext, aKidFrame->GetView(aPresContext, &kidView); nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView, &kidDesiredSize.mOverflowArea); - aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aKidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); return rv; } @@ -576,7 +576,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext, kidRect.width = kidDesiredSize.width; kidRect.height = kidDesiredSize.height; - FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0); } // If it's a 'initial', 'resize', or 'style change' reflow command (anything diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 9f010109d7d..e279839a7bf 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -238,8 +238,9 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent, @@ -532,7 +533,8 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext, } // Place and size the child - FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0); + FinishReflowChild(firstChild, aPresContext, nsnull, + kidMetrics, offset.x, offset.y, 0); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x", @@ -962,10 +964,11 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent*& aContent) } NS_IMETHODIMP -nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsLeafFrame::DidReflow(aPresContext, nsnull, aStatus); // The view is created hidden; once we have reflowed it and it has been diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index d3649cb6ca5..d0ca0ce9664 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -1013,7 +1013,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, // Place and size the child metrics.width = aSize.width; metrics.height = aSize.height; - FinishReflowChild(aChild, aPresContext, metrics, aOffset.x, aOffset.y, 0); + FinishReflowChild(aChild, aPresContext, nsnull, metrics, aOffset.x, aOffset.y, 0); } static diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index e1d37b12c01..1fd9b2705e0 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -672,7 +672,8 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus); // Set the child's width and height to it's desired size - FinishReflowChild(aFrame, aPresContext, aDesiredSize, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY); + FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize, + rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY); return rv; } diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index 5d6c9c4920e..fb62b36a760 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -425,7 +425,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, availSize.width = mLegendRect.width; } - FinishReflowChild(mLegendFrame, aPresContext, legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME); + FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState, + legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME); } } @@ -480,7 +481,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace); } - FinishReflowChild(mContentFrame, aPresContext, kidDesiredSize, contentRect.x, contentRect.y, 0); + FinishReflowChild(mContentFrame, aPresContext, &kidReflowState, + kidDesiredSize, contentRect.x, contentRect.y, 0); nsFrameState kidState; mContentFrame->GetFrameState(&kidState); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 656768a4a3f..abc81b00765 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -400,7 +400,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus status; rv = mTextFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status); if (NS_FAILED(rv)) return rv; - rv = mTextFrame->DidReflow(aPresContext, aStatus); + rv = mTextFrame->DidReflow(aPresContext, &txtKidReflowState, aStatus); if (NS_FAILED(rv)) return rv; // now adjust the frame positions diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 6f1a3bb2432..479e18be280 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -501,10 +501,11 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsFormControlFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsFormControlFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsLeafFrame::DidReflow(aPresContext, aReflowState, aStatus); // The view is created hidden; once we have reflowed it and it has been diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index 7c63f312071..cded9948a68 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -126,8 +126,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); /** * Respond to the request to resize and/or reflow diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 58e47067006..9e8de8f8c41 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -637,7 +637,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext, } // Place the child - FinishReflowChild(firstKid, aPresContext, aDesiredSize, + FinishReflowChild(firstKid, aPresContext, &reflowState, aDesiredSize, focusPadding.left + aReflowState.mComputedBorderPadding.right, yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0); diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index c270d385bd8..a17f072cde5 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -2411,19 +2411,20 @@ nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext, //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsListControlFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { if (PR_TRUE == IsInDropDownMode()) { //SyncViewWithFrame(); mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; - nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; SyncViewWithFrame(aPresContext); return rv; } else { - nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus); PRInt32 selectedIndex = mEndSelectionIndex; if (selectedIndex == kNothingSelected) { GetSelectedIndex(&selectedIndex); diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.h b/mozilla/layout/html/forms/src/nsListControlFrame.h index 5a6abd3ec57..438489fa8d2 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.h +++ b/mozilla/layout/html/forms/src/nsListControlFrame.h @@ -206,7 +206,9 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY); NS_IMETHOD Destroy(nsIPresContext *aPresContext); diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 4dcc56a59ee..2985821fd7e 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -77,7 +77,7 @@ nsTableCellFrame::nsTableCellFrame() { - mColIndex = 0; + mBits.mColIndex = 0; mPriorAvailWidth = 0; #ifdef DEBUG_TABLE_REFLOW_TIMING mTimer = new nsReflowTimer(this); @@ -131,6 +131,48 @@ nsTableCellFrame::Init(nsIPresContext* aPresContext, return rv; } +static PRBool +NoComputedHeightBetween(const nsHTMLReflowState& aReflowState, + nsIFrame* aCellFrame) +{ + for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) { + if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) || (0 != rs->mComputedHeight)) { + return PR_FALSE; + } + // stop when we hit the cell frame + if (rs->frame == aCellFrame) { + return PR_TRUE; + } + } + NS_ASSERTION(PR_FALSE, "program error in NoComputedHeightBetween"); + return PR_FALSE; +} + +// nsIPercentHeightObserver methods + +nsresult +nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState) +{ + if (!HadSpecialReflow()) { + // Only initiate a special reflow if we will be able to construct a computed height + // on the cell that will result in the frame getting a computed height. This can only + // happen (but not sufficient) if there no computed height already set between the + // initiating frame and the cell. + for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) { + if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) { + return NS_OK; + } + // stop when we reach the cell frame + if (rs->frame == this) { + nsTableFrame::NotifyAncestorsOfSpecialReflow((nsIFrame&)*this); + SetNeedSpecialReflow(PR_TRUE); + return NS_OK; + } + } + NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight"); + } + return NS_OK; +} nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex) const @@ -156,7 +198,7 @@ nsTableCellFrame::GetColIndex(PRInt32 &aColIndex) const return ((nsTableCellFrame*)GetFirstInFlow())->GetColIndex(aColIndex); } else { - aColIndex = mColIndex; + aColIndex = mBits.mColIndex; return NS_OK; } } @@ -246,7 +288,7 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex) nsresult nsTableCellFrame::SetColIndex(PRInt32 aColIndex) { - mColIndex = aColIndex; + mBits.mColIndex = aColIndex; // for style context optimization, set the content's column index if possible. // this can only be done if we really have an nsTableCell. // other tags mapped to table cell display won't benefit from this optimization @@ -766,7 +808,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, (0 == aReflowState.mComputedHeight)) && !mPrevInFlow && nsTableFrame::IsPctHeight(mStyleContext)) { - nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState); + nsTableFrame::NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } // this should probably be cached somewhere @@ -851,7 +893,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, aPresContext->IsPaginated(&isPaginated); nscoord computedPaginatedHeight = 0; - if (aReflowState.mFlags.mSpecialTableReflow || (eReflowReason_Incremental == aReflowState.reason)) { + if (aReflowState.mFlags.mSpecialHeightReflow || + (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) { ((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset; DISPLAY_REFLOW_CHANGE(); } @@ -866,6 +909,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, SetHasPctOverHeight(PR_FALSE); } nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize); + // mIPercentHeightObserver is for non table related frames inside cells + kidReflowState.mPercentHeightObserver = (nsIPercentHeightObserver *)this; // If it was a style change targeted at us, then reflow the child using // the special reflow reason @@ -899,8 +944,10 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, #if defined DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState); #endif + nscoord priorBlockHeight = GetLastBlockHeight(); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, kidOrigin.x, kidOrigin.y, 0, aStatus); + SetLastBlockHeight(kidSize.height); if (isStyleChanged) { Invalidate(aPresContext, mRect); } @@ -990,7 +1037,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, // NS_ASSERTION(kidSize.width <= availSize.width, "child needed more space during resize reflow"); //} // Place the child - FinishReflowChild(firstKid, aPresContext, kidSize, + FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize, kidOrigin.x, kidOrigin.y, 0); // first, compute the height which can be set w/o being restricted by aMaxSize.height @@ -1041,26 +1088,21 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, } } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { if (aDesiredSize.height > mRect.height) { - // set a bit and frame property indicating that the pct height contents exceeded + // set a bit indicating that the pct height contents exceeded // the height that they could honor in the pass 2 reflow SetHasPctOverHeight(PR_TRUE); - SetPctOverHeightValue(aPresContext, aDesiredSize.height); } aDesiredSize.height = mRect.height; SetNeedSpecialReflow(PR_FALSE); + SetHadSpecialReflow(PR_TRUE); } - else if ((eReflowReason_Incremental == aReflowState.reason) && HasPctOverHeight()) { - nscoord overValue; - GetPctOverHeightValue(aPresContext, overValue); - // if the pct over height value hasn't changed, use the last height of the cell, otherwise ignore it - if (aDesiredSize.height == overValue) { + else if (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason)) { + // if the block height value hasn't changed, use the last height of the cell, otherwise ignore it + if (GetLastBlockHeight() == priorBlockHeight) { aDesiredSize.height = mRect.height; } - else { - SetHasPctOverHeight(PR_FALSE); - } } else if (computedPaginatedHeight > 0) { nscoord height = computedPaginatedHeight + topInset + bottomInset - CalcHeightOfPrevInFlows(*this); @@ -1277,6 +1319,10 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr *aInstancePtr = (void*) (nsITableCellLayout *)this; return NS_OK; } + if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) { + *aInstancePtr = (void*) (nsIPercentHeightObserver *)this; + return NS_OK; + } return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); } @@ -1305,7 +1351,7 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex) aColIndex = 0; return res; } - aColIndex = mColIndex; + aColIndex = mBits.mColIndex; return NS_OK; } @@ -1447,27 +1493,6 @@ void nsTableCellFrame::GetCollapseOffset(nsIPresContext* aPresContext, } } -void nsTableCellFrame::SetPctOverHeightValue(nsIPresContext* aPresContext, - nscoord aValue) -{ - // Get the property - nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty, PR_TRUE); - if (value) { - *value = aValue; - } -} - -void nsTableCellFrame::GetPctOverHeightValue(nsIPresContext* aPresContext, - nscoord& aValue) -{ - aValue = 0; - // See if the property is set - nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty); - if (value) { - aValue = *value; - } -} - #ifdef DEBUG NS_IMETHODIMP nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h index 38ceb9ccc8e..bba34cedb09 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.h +++ b/mozilla/layout/html/table/src/nsTableCellFrame.h @@ -42,6 +42,7 @@ #include "nsHTMLContainerFrame.h" #include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex #include "nsIStyleContext.h" +#include "nsIPercentHeightObserver.h" class nsTableFrame; class nsHTMLValue; @@ -51,7 +52,8 @@ class nsHTMLValue; */ #define NS_TABLE_CELL_CONTENT_EMPTY 0x80000000 #define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000 -#define NS_TABLE_CELL_PCT_OVER_HEIGHT 0x20000000 +#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000 +#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000 /** * nsTableCellFrame @@ -64,7 +66,9 @@ class nsHTMLValue; * * @author sclark */ -class nsTableCellFrame : public nsHTMLContainerFrame, public nsITableCellLayout +class nsTableCellFrame : public nsHTMLContainerFrame, + public nsITableCellLayout, + public nsIPercentHeightObserver { public: @@ -111,6 +115,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame); + NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState); + void InitCellFrame(PRInt32 aColIndex); @@ -244,17 +250,20 @@ public: PRBool NeedSpecialReflow(); void SetNeedSpecialReflow(PRBool aContentEmpty); + PRBool HadSpecialReflow(); + void SetHadSpecialReflow(PRBool aValue); + PRBool HasPctOverHeight(); void SetHasPctOverHeight(PRBool aValue); + nscoord GetLastBlockHeight(); + void SetLastBlockHeight(nscoord aValue); + // The collapse offset is (0,0) except for cells originating in a row/col which is collapsed void SetCollapseOffsetX(nsIPresContext* aPresContext, nscoord aXOffset); void SetCollapseOffsetY(nsIPresContext* aPresContext, nscoord aYOffset); void GetCollapseOffset(nsIPresContext* aPresContext, nsPoint& aOffset); - void SetPctOverHeightValue(nsIPresContext* aPresContext, nscoord aValue); - void GetPctOverHeightValue(nsIPresContext* aPresContext, nscoord& aValue); - nsTableCellFrame* GetNextCell() const; protected: @@ -291,6 +300,10 @@ protected: protected: + struct Bits { + PRUint32 mColIndex:15; + PRUint32 mLastBlockHeight:17; + } mBits; PRInt32 mColIndex; // the starting column for this cell // XXX these could be stored as pixels for a savings of 6 x 2 bytes @@ -369,21 +382,45 @@ inline void nsTableCellFrame::SetNeedSpecialReflow(PRBool aValue) } } +inline PRBool nsTableCellFrame::HadSpecialReflow() +{ + return (mState & NS_TABLE_CELL_HAD_SPECIAL_REFLOW) == + NS_TABLE_CELL_HAD_SPECIAL_REFLOW; +} + +inline void nsTableCellFrame::SetHadSpecialReflow(PRBool aValue) +{ + if (aValue) { + mState |= NS_TABLE_CELL_HAD_SPECIAL_REFLOW; + } else { + mState &= ~NS_TABLE_CELL_HAD_SPECIAL_REFLOW; + } +} + inline PRBool nsTableCellFrame::HasPctOverHeight() { - return (mState & NS_TABLE_CELL_PCT_OVER_HEIGHT) == - NS_TABLE_CELL_PCT_OVER_HEIGHT; + return (mState & NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT) == + NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue) { if (aValue) { - mState |= NS_TABLE_CELL_PCT_OVER_HEIGHT; + mState |= NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } else { - mState &= ~NS_TABLE_CELL_PCT_OVER_HEIGHT; + mState &= ~NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } } +inline nscoord nsTableCellFrame::GetLastBlockHeight() +{ + return (nscoord)mBits.mLastBlockHeight; +} + +inline void nsTableCellFrame::SetLastBlockHeight(nscoord aValue) +{ + mBits.mLastBlockHeight = aValue; +} #endif diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index fc6d04be9d8..945dba1980d 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -503,7 +503,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus status; ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status); - FinishReflowChild(kidFrame, aPresContext, kidSize, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, 0, 0, 0); } aDesiredSize.width=0; @@ -608,7 +608,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext* aPresC nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, aStatus); - aNextFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aNextFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 6446c04c8ab..f0e7b863cd2 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1580,7 +1580,7 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState) { PRBool result = PR_TRUE; if (eReflowReason_Resize == aReflowState.reason) { - if (aReflowState.mFlags.mSpecialTableReflow && + if (aReflowState.mFlags.mSpecialHeightReflow && !NeedSpecialReflow() && !NeedToInitiateSpecialReflow()) { result = PR_FALSE; @@ -1816,26 +1816,25 @@ ProcessRowInserted(nsIPresContext* aPresContext, } void -nsTableFrame::NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState) +nsTableFrame::NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame) { - const nsHTMLReflowState* rs = aReflowState.parentReflowState; - while (rs) { + nsIFrame* parent; + for (aFrame.GetParent(&parent); parent; parent->GetParent(&parent)) { nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); + parent->GetFrameType(getter_AddRefs(frameType)); if (nsLayoutAtoms::tableCellFrame == frameType.get()) { - ((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableCellFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableRowFrame == frameType.get()) { - ((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableRowFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) { - ((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableRowGroupFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableFrame == frameType.get()) { - ((nsTableFrame*)rs->frame)->SetNeedToInitiateSpecialReflow(PR_TRUE); + ((nsTableFrame*)parent)->SetNeedToInitiateSpecialReflow(PR_TRUE); break; } - rs = rs->parentReflowState; } } @@ -1969,7 +1968,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, if ( ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) || (0 == aReflowState.mComputedHeight)) && IsPctHeight(mStyleContext) && IsSpecialNested(aReflowState)) { - NotifyAncestorsOfSpecialReflow(aReflowState); + NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } // see if an extra reflow will be necessary in pagination mode when there is a specified table height @@ -1982,21 +1981,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, } } // if we need to reflow the table an extra time, then don't constrain the height of the previous reflow - nscoord availHeight = !aReflowState.mFlags.mSpecialTableReflow && + nscoord availHeight = !aReflowState.mFlags.mSpecialHeightReflow && (NeedSpecialReflow() | NeedToInitiateSpecialReflow()) ? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight; ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason, doCollapse, balanced, aStatus); - if (!aReflowState.mFlags.mSpecialTableReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) { + if (!aReflowState.mFlags.mSpecialHeightReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) { aDesiredSize.height = CalcDesiredHeight(aPresContext, aReflowState); // distributes extra vertical space to rows - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_TRUE; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE; ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight, nextReason, doCollapse, balanced, aStatus); haveDesiredHeight = PR_TRUE; } } - else if (aReflowState.mFlags.mSpecialTableReflow) { + else if (aReflowState.mFlags.mSpecialHeightReflow) { aDesiredSize.width = mRect.width; aDesiredSize.height = mRect.height; #if defined DEBUG_TABLE_REFLOW_TIMING @@ -2060,7 +2059,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, } } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); SetNeedToInitiateSpecialReflow(PR_FALSE); } @@ -2846,7 +2845,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // the footer frame as well. We'll adjust the footer frame later on in // AdjustSiblingsAfterReflow() nsRect kidRect(aReflowState.x, aReflowState.y, desiredSize.width, desiredSize.height); - FinishReflowChild(aNextFrame, aPresContext, desiredSize, aReflowState.x, aReflowState.y, 0); + FinishReflowChild(aNextFrame, aPresContext, nsnull, desiredSize, aReflowState.x, aReflowState.y, 0); #ifndef TABLE_REFLOW_COALESCING_OFF // update the descendant reflow counts and determine if we need to request a timeout reflow @@ -2923,7 +2922,7 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize) { // Place and size the child - FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState.x, aReflowState.y, 0); + FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, aReflowState.x, aReflowState.y, 0); // Adjust the running y-offset aReflowState.y += aDesiredSize.height; @@ -3188,7 +3187,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext, nsReflowStatus status; ReflowChild(kidFrame, aPresContext, unusedDesiredSize, kidReflowState, 0, 0, 0, status); - kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } else if (childX < numRowGroups) { // it is a row group but isn't being reflowed @@ -3214,7 +3213,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext, aReflowState.availSize, aReflowState.reason); nsReflowStatus cgStatus; ReflowChild(kidFrame, aPresContext, kidMet, kidReflowState, 0, 0, 0, cgStatus); - FinishReflowChild(kidFrame, aPresContext, kidMet, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidMet, 0, 0, 0); } SetHaveReflowedColGroups(PR_TRUE); } @@ -4662,7 +4661,7 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame, PrettyUC(aState.availableWidth, width); PrettyUC(aState.availableHeight, height); printf("r=%d ", aState.reason); - if (aState.mFlags.mSpecialTableReflow) { + if (aState.mFlags.mSpecialHeightReflow) { printf("special "); } printf("a=%s,%s ", width, height); @@ -5086,10 +5085,6 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext, value = new nsPoint(0, 0); dtorFunc = DestroyPointFunc; } - else if (aPropertyName == nsLayoutAtoms::cellPctOverHeightProperty) { - value = new nscoord; - dtorFunc = DestroyCoordFunc; - } else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) { value = new nscoord; dtorFunc = DestroyCoordFunc; diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 0a7a24f6edd..a81d25848b7 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -212,7 +212,7 @@ public: float aPixelToTwips, nsPixelRound aRound= eAlwaysRoundUp); - static void NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState); + static void NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame); NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index 618f188cc60..8f1e6a6d920 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -955,6 +955,8 @@ nsTableOuterFrame::OuterReflowChild(nsIPresContext* aPresContext, nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame, nsSize(availWidth, availHeight)); childRS.reason = aReflowReason; + childRS.mPercentHeightObserver = nsnull; // the observer is for non table related frames inside cells + // If mComputedWidth > availWidth and availWidth >= minWidth for a nested percent table // then adjust mComputedWidth based on availableWidth if this isn't the intial reflow @@ -1137,7 +1139,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, captionMargin, innerSize, innerMargin, innerOrigin); - rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); if (NS_FAILED(rv)) return rv; @@ -1156,7 +1158,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y); } - rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, @@ -1328,7 +1330,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, innerMargin, captionSize, captionMargin, captionOrigin); - FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, @@ -1358,7 +1360,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, captionMargin, innerSize, innerMargin, innerOrigin); } - FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); UpdateReflowMetrics(captionSide, aOuterMet, innerMargin, innerMarginNoAuto, @@ -1418,7 +1420,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext, GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, captionMargin, innerSize, innerMargin, innerOrigin); - rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); if (NS_FAILED(rv)) return rv; GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, @@ -1436,7 +1438,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext, MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y); } - rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, @@ -1548,7 +1550,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, mCaptionFrame->WillReflow(aPresContext); rv = mCaptionFrame->Reflow(aPresContext, captionMet, captionReflowState, aStatus); - mCaptionFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + mCaptionFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); mMinCaptionWidth = maxElementSize.width; } } @@ -1586,7 +1588,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, innerMargin, captionSize, captionMargin, captionOrigin); - FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, @@ -1599,7 +1601,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, captionMargin, innerSize, innerMargin, innerOrigin); } - FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 29acb06116f..779964e95b9 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -936,7 +936,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { if (!isPaginated && (nsLayoutAtoms::tableCellFrame == frameType.get() && !((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) { kidFrame = iter.Next(); @@ -981,7 +981,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, (cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) || (eReflowReason_StyleChange == aReflowState.reason) || isPaginated || - (aReflowState.mFlags.mSpecialTableReflow && cellFrame->NeedSpecialReflow()) || + (aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) || HasPctHeight() || notifyStyleChange ){ // Reflow the cell to fit the available width, height @@ -1088,7 +1088,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, desiredSize.width = PR_MAX(availCellWidth, availColWidth); } - FinishReflowChild(kidFrame, aPresContext, desiredSize, x, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, desiredSize, x, 0, 0); x += desiredSize.width; } else {// it's an unknown frame type, give it a generic reflow and ignore the results @@ -1097,7 +1097,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, nsHTMLReflowMetrics desiredSize(nsnull); nsReflowStatus status; ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status); - kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } else if (nsLayoutAtoms::tableCellFrame == frameType.get()) { @@ -1323,7 +1323,7 @@ nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // Now place the child cellMet.width = colAvailWidth; - FinishReflowChild(aNextFrame, aPresContext, cellMet, cellOrigin.x, 0, 0); + FinishReflowChild(aNextFrame, aPresContext, nsnull, cellMet, cellOrigin.x, 0, 0); // Notify the table if the cell width changed so it can decide whether to rebalance if (!aDesiredSize.mNothingChanged) { @@ -1399,7 +1399,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, if (nsLayoutAtoms::tableRowGroupFrame == fType.get()) { nscoord pctBasis = ((nsTableRowGroupFrame*)parentRS->frame)->GetHeightBasis(*parentRS); if (0 == pctBasis) { - nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState); + nsTableFrame::NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } } @@ -1430,7 +1430,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, // just set our width to what was available. The table will calculate the width and not use our value. aDesiredSize.width = aReflowState.availableWidth; - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); } @@ -1500,7 +1500,7 @@ nsTableRowFrame::ReflowCellFrame(nsIPresContext* aPresContext, // XXX What happens if this cell has 'vertical-align: baseline' ? // XXX Why is it assumed that the cell's ascent hasn't changed ? aCellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent); - aCellFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aCellFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); return desiredSize.height; } diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index a21794a44ef..8008bf8baad 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -341,7 +341,7 @@ nsTableRowGroupFrame::PlaceChild(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize) { // Place and size the child - FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, 0, aReflowState.y, 0); + FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, 0, aReflowState.y, 0); // Adjust the running y-offset aReflowState.y += aDesiredSize.height; @@ -392,7 +392,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } - if (aReflowState.reflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) { if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType.get() && !((nsTableRowFrame*)kidFrame)->NeedSpecialReflow())) { doReflowChild = PR_FALSE; @@ -436,7 +436,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, // If this isn't the first row frame, then we can't be at the top of // the page anymore... if (kidFrame != GetFirstFrame()) { - kidReflowState.isTopOfPage = PR_FALSE; + kidReflowState.mFlags.mIsTopOfPage = PR_FALSE; } rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, @@ -1024,7 +1024,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext, rv = ReflowChild(rowFrame, aPresContext, desiredSize, rowReflowState, 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus); rowFrame->SizeTo(aPresContext, desiredSize.width, desiredSize.height); - rowFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + rowFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); rowFrame->DidResize(aPresContext, aReflowState); if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { @@ -1137,7 +1137,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // Check for an overflow list MoveOverflowToChildList(aPresContext); - if (isPaginated && aReflowState.mFlags.mSpecialTableReflow) { + if (isPaginated && aReflowState.mFlags.mSpecialHeightReflow) { // cache row height info for printing, now that row heights are known. CacheRowHeightsForPrinting(aPresContext, GetFirstRow()); } @@ -1158,7 +1158,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // reflow, then we need to do this because the table will skip the pass 2 reflow, // but we need to correctly calculate the row group height and we can't if there // are row spans unless we do this step - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { DidResizeRows(*aPresContext, aReflowState); } else if ((eReflowReason_Initial != aReflowState.reason) || @@ -1171,18 +1171,18 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // See if all the frames fit if (aDesiredSize.height > aReflowState.availableHeight) { // Nope, find a place to split the row group - PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialTableReflow; - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_FALSE; + PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialHeightReflow; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_FALSE; SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus); - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = specialReflow; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = specialReflow; } } SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) && (aReflowState.mComputedHeight > 0)); - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); } diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 685b44bcbba..773058042fe 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -1198,7 +1198,7 @@ nsMathMLContainerFrame::PlaceTokenFor(nsIFrame* aFrame, // place and size the child dy = aDesiredSize.ascent - rect.y; NS_STATIC_CAST(nsMathMLContainerFrame*, - aFrame)->FinishReflowChild(childFrame, aPresContext, + aFrame)->FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0); dx += rect.width; childFrame->GetNextSibling(&childFrame); @@ -1537,7 +1537,7 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext, GetItalicCorrection(bmChild, leftCorrection, italicCorrection); // add left correction dx += leftCorrection; - FinishReflowChild(childFrame, aPresContext, childSize, dx, dy, 0); + FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0); // add child size + italic correction dx += bmChild.width + italicCorrection; childFrame->GetNextSibling(&childFrame); diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h index d344452aa96..f461561a909 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -123,12 +123,13 @@ public: nsReflowStatus& aStatus); NS_IMETHOD - DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) + DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { mEmbellishData.flags &= ~NS_MATHML_STRETCH_DONE; - return nsHTMLContainerFrame::DidReflow(aPresContext, aStatus); + return nsHTMLContainerFrame::DidReflow(aPresContext, aReflowState, aStatus); } NS_IMETHOD diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index f063769c5a6..4583848ff80 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -386,7 +386,7 @@ nsMathMLmactionFrame::Place(nsIPresContext* aPresContext, if (childFrame) { GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics); if (aPlaceOrigin) { - FinishReflowChild(childFrame, aPresContext, aDesiredSize, 0, 0, 0); + FinishReflowChild(childFrame, aPresContext, nsnull, aDesiredSize, 0, 0, 0); } mReference.x = 0; mReference.y = aDesiredSize.ascent; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index a4e4f54410a..7af26acf768 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -388,7 +388,7 @@ nsMathMLmfencedFrame::Reflow(nsIPresContext* aPresContext, else mBoundingMetrics += bm; - FinishReflowChild(childFrame, aPresContext, childSize, + FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, aDesiredSize.ascent - childSize.ascent, 0); dx += childSize.width; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp index 465298a88e4..92d43152e1a 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp @@ -372,10 +372,10 @@ nsMathMLmfracFrame::Place(nsIPresContext* aPresContext, nscoord dy; // place numerator dy = 0; - FinishReflowChild(frameNum, aPresContext, sizeNum, dxNum, dy, 0); + FinishReflowChild(frameNum, aPresContext, nsnull, sizeNum, dxNum, dy, 0); // place denominator dy = aDesiredSize.height - sizeDen.height; - FinishReflowChild(frameDen, aPresContext, sizeDen, dxDen, dy, 0); + FinishReflowChild(frameDen, aPresContext, nsnull, sizeDen, dxDen, dy, 0); // place the fraction bar - dy is top of bar dy = aDesiredSize.ascent - (axisHeight + actualRuleThickness/2); mLineRect.SetRect(onePixel, dy, width - 2*onePixel, actualRuleThickness); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp index 88091f1c441..d8dcf046fb5 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp @@ -392,7 +392,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext, // place the base ... childFrame = baseFrame; dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0); + FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0); dx += bmBase.width + mScriptSpace + italicCorrection; } else if (mprescriptsFrame != childFrame) { @@ -415,12 +415,12 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext, dy = aDesiredSize.ascent - subScriptSize.ascent + maxSubScriptShift; - FinishReflowChild (subScriptFrame, aPresContext, subScriptSize, + FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize, dx + (width-subScriptSize.width)/2, dy, 0); dy = aDesiredSize.ascent - supScriptSize.ascent - maxSupScriptShift; - FinishReflowChild (supScriptFrame, aPresContext, supScriptSize, + FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize, dx + (width-supScriptSize.width)/2, dy, 0); dx += mScriptSpace + width; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp index a6c0a2236a0..bb7ec76112d 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp @@ -414,9 +414,9 @@ nsMathMLmoverFrame::Place(nsIPresContext* aPresContext, if (aPlaceOrigin) { // place base - FinishReflowChild (baseFrame, aPresContext, baseSize, dxBase, dyBase, 0); + FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dyBase, 0); // place overscript - FinishReflowChild (overFrame, aPresContext, overSize, dxOver, dyOver, 0); + FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dyOver, 0); } return NS_OK; } diff --git a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp index 90e8a7259b8..286e4115843 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp @@ -338,7 +338,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext, // place the index dx = dxIndex; dy = aDesiredSize.ascent - (indexRaisedAscent + indexSize.ascent - bmIndex.ascent); - FinishReflowChild(indexFrame, aPresContext, indexSize, dx, dy, 0); + FinishReflowChild(indexFrame, aPresContext, nsnull, indexSize, dx, dy, 0); // place the radical symbol and the radical bar dx = dxSqr; @@ -349,7 +349,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext, // place the base dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild(baseFrame, aPresContext, baseSize, dx, dy, 0); + FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0); mReference.x = 0; mReference.y = aDesiredSize.ascent; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp index c94dc2a93b0..d053894489e 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp @@ -246,13 +246,13 @@ nsMathMLmsubFrame::PlaceSubScript (nsIPresContext* aPresContext, nscoord dx, dy; // now place the base ... dx = 0; dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0); + FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0); // ... and subscript // XXX adding mScriptSpace seems to add more space than i like // may want to remove later. dx = bmBase.width + aScriptSpace; dy = aDesiredSize.ascent - (subScriptSize.ascent - actualSubScriptShift); - FinishReflowChild (subScriptFrame, aPresContext, subScriptSize, dx, dy, 0); + FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0); } return NS_OK; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp index 1c3302e25f8..e6bf6010c9b 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp @@ -369,15 +369,15 @@ nsMathMLmsubsupFrame::PlaceSubSupScript (nsIPresContext* aPresContext, nscoord dx, dy; // now place the base ... dx = 0; dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild(baseFrame, aPresContext, baseSize, dx, dy, 0); + FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0); // ... and subscript dx = bmBase.width + aScriptSpace; dy = aDesiredSize.ascent - (subScriptSize.ascent - subScriptShift); - FinishReflowChild(subScriptFrame, aPresContext, subScriptSize, dx, dy, 0); + FinishReflowChild(subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0); // ... and the superscript dx = bmBase.width + aScriptSpace + italicCorrection; dy = aDesiredSize.ascent - (supScriptSize.ascent + supScriptShift); - FinishReflowChild(supScriptFrame, aPresContext, supScriptSize, dx, dy, 0); + FinishReflowChild(supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0); } return NS_OK; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp index d3d271262a0..a0dbe165095 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp @@ -275,11 +275,11 @@ nsMathMLmsupFrame::PlaceSuperScript(nsIPresContext* aPresContext, nscoord dx, dy; // now place the base ... dx = 0; dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0); + FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0); // ... and supscript dx = bmBase.width + aScriptSpace + italicCorrection; dy = aDesiredSize.ascent - (supScriptSize.ascent + actualSupScriptShift); - FinishReflowChild (supScriptFrame, aPresContext, supScriptSize, dx, dy, 0); + FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0); } return NS_OK; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp index 9b173b2c4ac..944879f128d 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp @@ -347,10 +347,10 @@ nsMathMLmunderFrame::Place(nsIPresContext* aPresContext, if (aPlaceOrigin) { nscoord dy = 0; // place base - FinishReflowChild(baseFrame, aPresContext, baseSize, dxBase, dy, 0); + FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0); // place underscript dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent; - FinishReflowChild(underFrame, aPresContext, underSize, dxUnder, dy, 0); + FinishReflowChild(underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0); } return NS_OK; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp index a7e86e13a41..5c55bfd9a25 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp @@ -448,13 +448,13 @@ nsMathMLmunderoverFrame::Place(nsIPresContext* aPresContext, nscoord dy; // place overscript dy = aDesiredSize.ascent - mBoundingMetrics.ascent + bmOver.ascent - overSize.ascent; - FinishReflowChild (overFrame, aPresContext, overSize, dxOver, dy, 0); + FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dy, 0); // place base dy = aDesiredSize.ascent - baseSize.ascent; - FinishReflowChild (baseFrame, aPresContext, baseSize, dxBase, dy, 0); + FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0); // place underscript dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent; - FinishReflowChild (underFrame, aPresContext, underSize, dxUnder, dy, 0); + FinishReflowChild (underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0); } return NS_OK; } diff --git a/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp b/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp index db18997acc3..0fa445815ec 100644 --- a/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp @@ -185,7 +185,7 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext, incrementalChild->SetRect(aPresContext, rect); if (NS_FAILED(rv)) return rv; - rv = incrementalChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + rv = incrementalChild->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); if (NS_FAILED(rv)) return rv; nsIFrame * child = mFrames.FirstChild(); @@ -241,7 +241,7 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext, child->SetRect(aPresContext, rect); if (NS_FAILED(rv)) return rv; - rv = child->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + rv = child->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); if (NS_FAILED(rv)) return rv; child->GetNextSibling(&child); } @@ -263,10 +263,11 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext, NS_IMETHODIMP -nsSVGContainerFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsSVGContainerFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { - nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aReflowState, aStatus); NS_ASSERTION(rv == NS_OK,"DidReflow failed"); return rv; diff --git a/mozilla/layout/svg/base/src/nsSVGContainerFrame.h b/mozilla/layout/svg/base/src/nsSVGContainerFrame.h index 0b23625239b..b80c819ed0c 100644 --- a/mozilla/layout/svg/base/src/nsSVGContainerFrame.h +++ b/mozilla/layout/svg/base/src/nsSVGContainerFrame.h @@ -65,8 +65,9 @@ public: PRInt32& aCursor); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild); diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 4dcc56a59ee..2985821fd7e 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -77,7 +77,7 @@ nsTableCellFrame::nsTableCellFrame() { - mColIndex = 0; + mBits.mColIndex = 0; mPriorAvailWidth = 0; #ifdef DEBUG_TABLE_REFLOW_TIMING mTimer = new nsReflowTimer(this); @@ -131,6 +131,48 @@ nsTableCellFrame::Init(nsIPresContext* aPresContext, return rv; } +static PRBool +NoComputedHeightBetween(const nsHTMLReflowState& aReflowState, + nsIFrame* aCellFrame) +{ + for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) { + if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) || (0 != rs->mComputedHeight)) { + return PR_FALSE; + } + // stop when we hit the cell frame + if (rs->frame == aCellFrame) { + return PR_TRUE; + } + } + NS_ASSERTION(PR_FALSE, "program error in NoComputedHeightBetween"); + return PR_FALSE; +} + +// nsIPercentHeightObserver methods + +nsresult +nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState) +{ + if (!HadSpecialReflow()) { + // Only initiate a special reflow if we will be able to construct a computed height + // on the cell that will result in the frame getting a computed height. This can only + // happen (but not sufficient) if there no computed height already set between the + // initiating frame and the cell. + for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) { + if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) { + return NS_OK; + } + // stop when we reach the cell frame + if (rs->frame == this) { + nsTableFrame::NotifyAncestorsOfSpecialReflow((nsIFrame&)*this); + SetNeedSpecialReflow(PR_TRUE); + return NS_OK; + } + } + NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight"); + } + return NS_OK; +} nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex) const @@ -156,7 +198,7 @@ nsTableCellFrame::GetColIndex(PRInt32 &aColIndex) const return ((nsTableCellFrame*)GetFirstInFlow())->GetColIndex(aColIndex); } else { - aColIndex = mColIndex; + aColIndex = mBits.mColIndex; return NS_OK; } } @@ -246,7 +288,7 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex) nsresult nsTableCellFrame::SetColIndex(PRInt32 aColIndex) { - mColIndex = aColIndex; + mBits.mColIndex = aColIndex; // for style context optimization, set the content's column index if possible. // this can only be done if we really have an nsTableCell. // other tags mapped to table cell display won't benefit from this optimization @@ -766,7 +808,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, (0 == aReflowState.mComputedHeight)) && !mPrevInFlow && nsTableFrame::IsPctHeight(mStyleContext)) { - nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState); + nsTableFrame::NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } // this should probably be cached somewhere @@ -851,7 +893,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, aPresContext->IsPaginated(&isPaginated); nscoord computedPaginatedHeight = 0; - if (aReflowState.mFlags.mSpecialTableReflow || (eReflowReason_Incremental == aReflowState.reason)) { + if (aReflowState.mFlags.mSpecialHeightReflow || + (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) { ((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset; DISPLAY_REFLOW_CHANGE(); } @@ -866,6 +909,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, SetHasPctOverHeight(PR_FALSE); } nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize); + // mIPercentHeightObserver is for non table related frames inside cells + kidReflowState.mPercentHeightObserver = (nsIPercentHeightObserver *)this; // If it was a style change targeted at us, then reflow the child using // the special reflow reason @@ -899,8 +944,10 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, #if defined DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState); #endif + nscoord priorBlockHeight = GetLastBlockHeight(); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, kidOrigin.x, kidOrigin.y, 0, aStatus); + SetLastBlockHeight(kidSize.height); if (isStyleChanged) { Invalidate(aPresContext, mRect); } @@ -990,7 +1037,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, // NS_ASSERTION(kidSize.width <= availSize.width, "child needed more space during resize reflow"); //} // Place the child - FinishReflowChild(firstKid, aPresContext, kidSize, + FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize, kidOrigin.x, kidOrigin.y, 0); // first, compute the height which can be set w/o being restricted by aMaxSize.height @@ -1041,26 +1088,21 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, } } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { if (aDesiredSize.height > mRect.height) { - // set a bit and frame property indicating that the pct height contents exceeded + // set a bit indicating that the pct height contents exceeded // the height that they could honor in the pass 2 reflow SetHasPctOverHeight(PR_TRUE); - SetPctOverHeightValue(aPresContext, aDesiredSize.height); } aDesiredSize.height = mRect.height; SetNeedSpecialReflow(PR_FALSE); + SetHadSpecialReflow(PR_TRUE); } - else if ((eReflowReason_Incremental == aReflowState.reason) && HasPctOverHeight()) { - nscoord overValue; - GetPctOverHeightValue(aPresContext, overValue); - // if the pct over height value hasn't changed, use the last height of the cell, otherwise ignore it - if (aDesiredSize.height == overValue) { + else if (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason)) { + // if the block height value hasn't changed, use the last height of the cell, otherwise ignore it + if (GetLastBlockHeight() == priorBlockHeight) { aDesiredSize.height = mRect.height; } - else { - SetHasPctOverHeight(PR_FALSE); - } } else if (computedPaginatedHeight > 0) { nscoord height = computedPaginatedHeight + topInset + bottomInset - CalcHeightOfPrevInFlows(*this); @@ -1277,6 +1319,10 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr *aInstancePtr = (void*) (nsITableCellLayout *)this; return NS_OK; } + if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) { + *aInstancePtr = (void*) (nsIPercentHeightObserver *)this; + return NS_OK; + } return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); } @@ -1305,7 +1351,7 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex) aColIndex = 0; return res; } - aColIndex = mColIndex; + aColIndex = mBits.mColIndex; return NS_OK; } @@ -1447,27 +1493,6 @@ void nsTableCellFrame::GetCollapseOffset(nsIPresContext* aPresContext, } } -void nsTableCellFrame::SetPctOverHeightValue(nsIPresContext* aPresContext, - nscoord aValue) -{ - // Get the property - nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty, PR_TRUE); - if (value) { - *value = aValue; - } -} - -void nsTableCellFrame::GetPctOverHeightValue(nsIPresContext* aPresContext, - nscoord& aValue) -{ - aValue = 0; - // See if the property is set - nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty); - if (value) { - aValue = *value; - } -} - #ifdef DEBUG NS_IMETHODIMP nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h index 38ceb9ccc8e..bba34cedb09 100644 --- a/mozilla/layout/tables/nsTableCellFrame.h +++ b/mozilla/layout/tables/nsTableCellFrame.h @@ -42,6 +42,7 @@ #include "nsHTMLContainerFrame.h" #include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex #include "nsIStyleContext.h" +#include "nsIPercentHeightObserver.h" class nsTableFrame; class nsHTMLValue; @@ -51,7 +52,8 @@ class nsHTMLValue; */ #define NS_TABLE_CELL_CONTENT_EMPTY 0x80000000 #define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000 -#define NS_TABLE_CELL_PCT_OVER_HEIGHT 0x20000000 +#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000 +#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000 /** * nsTableCellFrame @@ -64,7 +66,9 @@ class nsHTMLValue; * * @author sclark */ -class nsTableCellFrame : public nsHTMLContainerFrame, public nsITableCellLayout +class nsTableCellFrame : public nsHTMLContainerFrame, + public nsITableCellLayout, + public nsIPercentHeightObserver { public: @@ -111,6 +115,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame); + NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState); + void InitCellFrame(PRInt32 aColIndex); @@ -244,17 +250,20 @@ public: PRBool NeedSpecialReflow(); void SetNeedSpecialReflow(PRBool aContentEmpty); + PRBool HadSpecialReflow(); + void SetHadSpecialReflow(PRBool aValue); + PRBool HasPctOverHeight(); void SetHasPctOverHeight(PRBool aValue); + nscoord GetLastBlockHeight(); + void SetLastBlockHeight(nscoord aValue); + // The collapse offset is (0,0) except for cells originating in a row/col which is collapsed void SetCollapseOffsetX(nsIPresContext* aPresContext, nscoord aXOffset); void SetCollapseOffsetY(nsIPresContext* aPresContext, nscoord aYOffset); void GetCollapseOffset(nsIPresContext* aPresContext, nsPoint& aOffset); - void SetPctOverHeightValue(nsIPresContext* aPresContext, nscoord aValue); - void GetPctOverHeightValue(nsIPresContext* aPresContext, nscoord& aValue); - nsTableCellFrame* GetNextCell() const; protected: @@ -291,6 +300,10 @@ protected: protected: + struct Bits { + PRUint32 mColIndex:15; + PRUint32 mLastBlockHeight:17; + } mBits; PRInt32 mColIndex; // the starting column for this cell // XXX these could be stored as pixels for a savings of 6 x 2 bytes @@ -369,21 +382,45 @@ inline void nsTableCellFrame::SetNeedSpecialReflow(PRBool aValue) } } +inline PRBool nsTableCellFrame::HadSpecialReflow() +{ + return (mState & NS_TABLE_CELL_HAD_SPECIAL_REFLOW) == + NS_TABLE_CELL_HAD_SPECIAL_REFLOW; +} + +inline void nsTableCellFrame::SetHadSpecialReflow(PRBool aValue) +{ + if (aValue) { + mState |= NS_TABLE_CELL_HAD_SPECIAL_REFLOW; + } else { + mState &= ~NS_TABLE_CELL_HAD_SPECIAL_REFLOW; + } +} + inline PRBool nsTableCellFrame::HasPctOverHeight() { - return (mState & NS_TABLE_CELL_PCT_OVER_HEIGHT) == - NS_TABLE_CELL_PCT_OVER_HEIGHT; + return (mState & NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT) == + NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue) { if (aValue) { - mState |= NS_TABLE_CELL_PCT_OVER_HEIGHT; + mState |= NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } else { - mState &= ~NS_TABLE_CELL_PCT_OVER_HEIGHT; + mState &= ~NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT; } } +inline nscoord nsTableCellFrame::GetLastBlockHeight() +{ + return (nscoord)mBits.mLastBlockHeight; +} + +inline void nsTableCellFrame::SetLastBlockHeight(nscoord aValue) +{ + mBits.mLastBlockHeight = aValue; +} #endif diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index fc6d04be9d8..945dba1980d 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -503,7 +503,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus status; ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status); - FinishReflowChild(kidFrame, aPresContext, kidSize, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, 0, 0, 0); } aDesiredSize.width=0; @@ -608,7 +608,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext* aPresC nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, aStatus); - aNextFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aNextFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 6446c04c8ab..f0e7b863cd2 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1580,7 +1580,7 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState) { PRBool result = PR_TRUE; if (eReflowReason_Resize == aReflowState.reason) { - if (aReflowState.mFlags.mSpecialTableReflow && + if (aReflowState.mFlags.mSpecialHeightReflow && !NeedSpecialReflow() && !NeedToInitiateSpecialReflow()) { result = PR_FALSE; @@ -1816,26 +1816,25 @@ ProcessRowInserted(nsIPresContext* aPresContext, } void -nsTableFrame::NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState) +nsTableFrame::NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame) { - const nsHTMLReflowState* rs = aReflowState.parentReflowState; - while (rs) { + nsIFrame* parent; + for (aFrame.GetParent(&parent); parent; parent->GetParent(&parent)) { nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); + parent->GetFrameType(getter_AddRefs(frameType)); if (nsLayoutAtoms::tableCellFrame == frameType.get()) { - ((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableCellFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableRowFrame == frameType.get()) { - ((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableRowFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) { - ((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); + ((nsTableRowGroupFrame*)parent)->SetNeedSpecialReflow(PR_TRUE); } else if (nsLayoutAtoms::tableFrame == frameType.get()) { - ((nsTableFrame*)rs->frame)->SetNeedToInitiateSpecialReflow(PR_TRUE); + ((nsTableFrame*)parent)->SetNeedToInitiateSpecialReflow(PR_TRUE); break; } - rs = rs->parentReflowState; } } @@ -1969,7 +1968,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, if ( ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) || (0 == aReflowState.mComputedHeight)) && IsPctHeight(mStyleContext) && IsSpecialNested(aReflowState)) { - NotifyAncestorsOfSpecialReflow(aReflowState); + NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } // see if an extra reflow will be necessary in pagination mode when there is a specified table height @@ -1982,21 +1981,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, } } // if we need to reflow the table an extra time, then don't constrain the height of the previous reflow - nscoord availHeight = !aReflowState.mFlags.mSpecialTableReflow && + nscoord availHeight = !aReflowState.mFlags.mSpecialHeightReflow && (NeedSpecialReflow() | NeedToInitiateSpecialReflow()) ? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight; ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason, doCollapse, balanced, aStatus); - if (!aReflowState.mFlags.mSpecialTableReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) { + if (!aReflowState.mFlags.mSpecialHeightReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) { aDesiredSize.height = CalcDesiredHeight(aPresContext, aReflowState); // distributes extra vertical space to rows - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_TRUE; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE; ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight, nextReason, doCollapse, balanced, aStatus); haveDesiredHeight = PR_TRUE; } } - else if (aReflowState.mFlags.mSpecialTableReflow) { + else if (aReflowState.mFlags.mSpecialHeightReflow) { aDesiredSize.width = mRect.width; aDesiredSize.height = mRect.height; #if defined DEBUG_TABLE_REFLOW_TIMING @@ -2060,7 +2059,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, } } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); SetNeedToInitiateSpecialReflow(PR_FALSE); } @@ -2846,7 +2845,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // the footer frame as well. We'll adjust the footer frame later on in // AdjustSiblingsAfterReflow() nsRect kidRect(aReflowState.x, aReflowState.y, desiredSize.width, desiredSize.height); - FinishReflowChild(aNextFrame, aPresContext, desiredSize, aReflowState.x, aReflowState.y, 0); + FinishReflowChild(aNextFrame, aPresContext, nsnull, desiredSize, aReflowState.x, aReflowState.y, 0); #ifndef TABLE_REFLOW_COALESCING_OFF // update the descendant reflow counts and determine if we need to request a timeout reflow @@ -2923,7 +2922,7 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize) { // Place and size the child - FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState.x, aReflowState.y, 0); + FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, aReflowState.x, aReflowState.y, 0); // Adjust the running y-offset aReflowState.y += aDesiredSize.height; @@ -3188,7 +3187,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext, nsReflowStatus status; ReflowChild(kidFrame, aPresContext, unusedDesiredSize, kidReflowState, 0, 0, 0, status); - kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } else if (childX < numRowGroups) { // it is a row group but isn't being reflowed @@ -3214,7 +3213,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext, aReflowState.availSize, aReflowState.reason); nsReflowStatus cgStatus; ReflowChild(kidFrame, aPresContext, kidMet, kidReflowState, 0, 0, 0, cgStatus); - FinishReflowChild(kidFrame, aPresContext, kidMet, 0, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, kidMet, 0, 0, 0); } SetHaveReflowedColGroups(PR_TRUE); } @@ -4662,7 +4661,7 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame, PrettyUC(aState.availableWidth, width); PrettyUC(aState.availableHeight, height); printf("r=%d ", aState.reason); - if (aState.mFlags.mSpecialTableReflow) { + if (aState.mFlags.mSpecialHeightReflow) { printf("special "); } printf("a=%s,%s ", width, height); @@ -5086,10 +5085,6 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext, value = new nsPoint(0, 0); dtorFunc = DestroyPointFunc; } - else if (aPropertyName == nsLayoutAtoms::cellPctOverHeightProperty) { - value = new nscoord; - dtorFunc = DestroyCoordFunc; - } else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) { value = new nscoord; dtorFunc = DestroyCoordFunc; diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 0a7a24f6edd..a81d25848b7 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -212,7 +212,7 @@ public: float aPixelToTwips, nsPixelRound aRound= eAlwaysRoundUp); - static void NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState); + static void NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame); NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 618f188cc60..8f1e6a6d920 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -955,6 +955,8 @@ nsTableOuterFrame::OuterReflowChild(nsIPresContext* aPresContext, nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame, nsSize(availWidth, availHeight)); childRS.reason = aReflowReason; + childRS.mPercentHeightObserver = nsnull; // the observer is for non table related frames inside cells + // If mComputedWidth > availWidth and availWidth >= minWidth for a nested percent table // then adjust mComputedWidth based on availableWidth if this isn't the intial reflow @@ -1137,7 +1139,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, captionMargin, innerSize, innerMargin, innerOrigin); - rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); if (NS_FAILED(rv)) return rv; @@ -1156,7 +1158,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y); } - rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, @@ -1328,7 +1330,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, innerMargin, captionSize, captionMargin, captionOrigin); - FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, @@ -1358,7 +1360,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, captionMargin, innerSize, innerMargin, innerOrigin); } - FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); UpdateReflowMetrics(captionSide, aOuterMet, innerMargin, innerMarginNoAuto, @@ -1418,7 +1420,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext, GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, captionMargin, innerSize, innerMargin, innerOrigin); - rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); if (NS_FAILED(rv)) return rv; GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, @@ -1436,7 +1438,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext, MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y); } - rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, @@ -1548,7 +1550,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, mCaptionFrame->WillReflow(aPresContext); rv = mCaptionFrame->Reflow(aPresContext, captionMet, captionReflowState, aStatus); - mCaptionFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + mCaptionFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); mMinCaptionWidth = maxElementSize.width; } } @@ -1586,7 +1588,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize, innerMargin, captionSize, captionMargin, captionOrigin); - FinishReflowChild(mCaptionFrame, aPresContext, captionMet, + FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet, captionOrigin.x, captionOrigin.y, 0); GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, @@ -1599,7 +1601,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, captionMargin, innerSize, innerMargin, innerOrigin); } - FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, + FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet, innerOrigin.x, innerOrigin.y, 0); UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto, diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 29acb06116f..779964e95b9 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -936,7 +936,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { if (!isPaginated && (nsLayoutAtoms::tableCellFrame == frameType.get() && !((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) { kidFrame = iter.Next(); @@ -981,7 +981,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, (cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) || (eReflowReason_StyleChange == aReflowState.reason) || isPaginated || - (aReflowState.mFlags.mSpecialTableReflow && cellFrame->NeedSpecialReflow()) || + (aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) || HasPctHeight() || notifyStyleChange ){ // Reflow the cell to fit the available width, height @@ -1088,7 +1088,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, desiredSize.width = PR_MAX(availCellWidth, availColWidth); } - FinishReflowChild(kidFrame, aPresContext, desiredSize, x, 0, 0); + FinishReflowChild(kidFrame, aPresContext, nsnull, desiredSize, x, 0, 0); x += desiredSize.width; } else {// it's an unknown frame type, give it a generic reflow and ignore the results @@ -1097,7 +1097,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, nsHTMLReflowMetrics desiredSize(nsnull); nsReflowStatus status; ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status); - kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } else if (nsLayoutAtoms::tableCellFrame == frameType.get()) { @@ -1323,7 +1323,7 @@ nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // Now place the child cellMet.width = colAvailWidth; - FinishReflowChild(aNextFrame, aPresContext, cellMet, cellOrigin.x, 0, 0); + FinishReflowChild(aNextFrame, aPresContext, nsnull, cellMet, cellOrigin.x, 0, 0); // Notify the table if the cell width changed so it can decide whether to rebalance if (!aDesiredSize.mNothingChanged) { @@ -1399,7 +1399,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, if (nsLayoutAtoms::tableRowGroupFrame == fType.get()) { nscoord pctBasis = ((nsTableRowGroupFrame*)parentRS->frame)->GetHeightBasis(*parentRS); if (0 == pctBasis) { - nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState); + nsTableFrame::NotifyAncestorsOfSpecialReflow(*this); SetNeedSpecialReflow(PR_TRUE); } } @@ -1430,7 +1430,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, // just set our width to what was available. The table will calculate the width and not use our value. aDesiredSize.width = aReflowState.availableWidth; - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); } @@ -1500,7 +1500,7 @@ nsTableRowFrame::ReflowCellFrame(nsIPresContext* aPresContext, // XXX What happens if this cell has 'vertical-align: baseline' ? // XXX Why is it assumed that the cell's ascent hasn't changed ? aCellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent); - aCellFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + aCellFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); return desiredSize.height; } diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index a21794a44ef..8008bf8baad 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -341,7 +341,7 @@ nsTableRowGroupFrame::PlaceChild(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize) { // Place and size the child - FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, 0, aReflowState.y, 0); + FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, 0, aReflowState.y, 0); // Adjust the running y-offset aReflowState.y += aDesiredSize.height; @@ -392,7 +392,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } - if (aReflowState.reflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) { if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType.get() && !((nsTableRowFrame*)kidFrame)->NeedSpecialReflow())) { doReflowChild = PR_FALSE; @@ -436,7 +436,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, // If this isn't the first row frame, then we can't be at the top of // the page anymore... if (kidFrame != GetFirstFrame()) { - kidReflowState.isTopOfPage = PR_FALSE; + kidReflowState.mFlags.mIsTopOfPage = PR_FALSE; } rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, @@ -1024,7 +1024,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext, rv = ReflowChild(rowFrame, aPresContext, desiredSize, rowReflowState, 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus); rowFrame->SizeTo(aPresContext, desiredSize.width, desiredSize.height); - rowFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + rowFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); rowFrame->DidResize(aPresContext, aReflowState); if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { @@ -1137,7 +1137,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // Check for an overflow list MoveOverflowToChildList(aPresContext); - if (isPaginated && aReflowState.mFlags.mSpecialTableReflow) { + if (isPaginated && aReflowState.mFlags.mSpecialHeightReflow) { // cache row height info for printing, now that row heights are known. CacheRowHeightsForPrinting(aPresContext, GetFirstRow()); } @@ -1158,7 +1158,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // reflow, then we need to do this because the table will skip the pass 2 reflow, // but we need to correctly calculate the row group height and we can't if there // are row spans unless we do this step - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { DidResizeRows(*aPresContext, aReflowState); } else if ((eReflowReason_Initial != aReflowState.reason) || @@ -1171,18 +1171,18 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, // See if all the frames fit if (aDesiredSize.height > aReflowState.availableHeight) { // Nope, find a place to split the row group - PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialTableReflow; - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_FALSE; + PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialHeightReflow; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_FALSE; SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus); - ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = specialReflow; + ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = specialReflow; } } SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) && (aReflowState.mComputedHeight > 0)); - if (aReflowState.mFlags.mSpecialTableReflow) { + if (aReflowState.mFlags.mSpecialHeightReflow) { SetNeedSpecialReflow(PR_FALSE); } diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index f556f436e83..128dfb01f40 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -815,12 +815,13 @@ nsBoxFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) } NS_IMETHODIMP -nsBoxFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsBoxFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { PRBool isDirty = mState & NS_FRAME_IS_DIRTY; PRBool hasDirtyChildren = mState & NS_FRAME_HAS_DIRTY_CHILDREN; - nsresult rv = nsFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsFrame::DidReflow(aPresContext, aReflowState, aStatus); if (isDirty) mState |= NS_FRAME_IS_DIRTY; @@ -1891,6 +1892,15 @@ nsBoxFrame::GetFrameName(nsAString& aResult) const } #endif +NS_IMETHODIMP +nsBoxFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::boxFrame; + NS_ADDREF(*aType); + return NS_OK; +} + NS_IMETHODIMP nsBoxFrame::GetDebug(PRBool& aDebug) { diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h index 4586dc0cbde..870f16e9638 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsBoxFrame.h @@ -169,12 +169,14 @@ public: nsIAtom* aListName, nsIFrame* aChildList); + NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); virtual PRBool IsHorizontal() const; virtual PRBool IsNormalDirection() const; diff --git a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp index fd57c204830..bd367e9c34c 100644 --- a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp +++ b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp @@ -807,7 +807,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, mFrame->WillReflow(aPresContext); mFrame->Reflow(aPresContext, aDesiredSize, reflowState, aStatus); - mFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + mFrame->DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); reflowState.mComputedWidth = aDesiredSize.width - (border.left + border.right); reflowState.availableWidth = reflowState.mComputedWidth; reflowState.reason = eReflowReason_StyleChange; @@ -858,7 +858,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, reflowState.availableWidth = reflowState.mComputedWidth; reflowState.reason = eReflowReason_Resize; reflowState.reflowCommand = nsnull; - mFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); + mFrame->DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); nsAdaptorPrintReason(reflowState); @@ -893,7 +893,8 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, if (mLastSize.width != aDesiredSize.width || mLastSize.height != aDesiredSize.height) changedSize = PR_TRUE; - nsContainerFrame::FinishReflowChild(mFrame, aPresContext, aDesiredSize, aX, aY, NS_FRAME_NO_MOVE_FRAME); + nsContainerFrame::FinishReflowChild(mFrame, aPresContext, &reflowState, + aDesiredSize, aX, aY, NS_FRAME_NO_MOVE_FRAME); } else { aDesiredSize.ascent = mBlockAscent; } diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp index 6af78eb2738..d018a083341 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -193,12 +193,13 @@ nsLeafBoxFrame::GetFrame(nsIFrame** aFrame) } NS_IMETHODIMP -nsLeafBoxFrame::DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus) +nsLeafBoxFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) { PRBool isDirty = mState & NS_FRAME_IS_DIRTY; PRBool hasDirtyChildren = mState & NS_FRAME_HAS_DIRTY_CHILDREN; - nsresult rv = nsFrame::DidReflow(aPresContext, aStatus); + nsresult rv = nsFrame::DidReflow(aPresContext, aReflowState, aStatus); if (isDirty) mState |= NS_FRAME_IS_DIRTY; diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h index cc2f4db86cb..426819fcf0d 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h @@ -67,8 +67,9 @@ public: nsIContent* aChild, nsISupports* aSubContent); - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - nsDidReflowStatus aStatus); + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent,