diff --git a/mozilla/layout/base/public/nsIFrameReflow.h b/mozilla/layout/base/public/nsIFrameReflow.h index 90926df21e3..38b4e502375 100644 --- a/mozilla/layout/base/public/nsIFrameReflow.h +++ b/mozilla/layout/base/public/nsIFrameReflow.h @@ -85,9 +85,10 @@ enum nsReflowReason { /** * Reflow state passed to a frame during reflow. The reflow states are linked - * together. The max size represents the max available space in which to reflow - * your frame, and is computed as the parent frame's available content area - * minus any room for margins that your frame requests. A value of + * together. The availableWidth and availableHeight represent the available + * space in which to reflow your frame, and are computed based on the parent + * frame's computed width and computed height. The available space is the total + * space including margins, border, padding, and content area. A value of * NS_UNCONSTRAINEDSIZE means you can choose whatever size you want * * @see #Reflow() @@ -97,7 +98,8 @@ struct nsReflowState { nsIFrame* frame; // the frame being reflowed nsReflowReason reason; // the reason for the reflow nsIReflowCommand* reflowCommand; // the reflow command. only set for eReflowReason_Incremental - nsSize maxSize; // the max available space in which to reflow + nscoord availableWidth, + availableHeight; // the available space in which to reflow nsIRenderingContext* rendContext; // rendering context to use for measurement PRPackedBool isTopOfPage; // is the current context at the top of a page? @@ -108,29 +110,29 @@ struct nsReflowState { // non-incremental reflow command nsReflowState(nsIFrame* aFrame, nsReflowReason aReason, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext); // Constructs an initial reflow state (no parent reflow state) for an // incremental reflow command nsReflowState(nsIFrame* aFrame, nsIReflowCommand& aReflowCommand, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext); // Construct a reflow state for the given frame, parent reflow state, and - // max size. Uses the reflow reason, reflow command, and isTopOfPage value + // available space. Uses the reflow reason, reflow command, and isTopOfPage value // from the parent's reflow state nsReflowState(nsIFrame* aFrame, const nsReflowState& aParentReflowState, - const nsSize& aMaxSize); + const nsSize& aAvailableSpace); // Constructs a reflow state that overrides the reflow reason of the parent // reflow state. Uses the isTopOfPage value from the parent's reflow state, and // sets the reflow command to NULL nsReflowState(nsIFrame* aFrame, const nsReflowState& aParentReflowState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsReflowReason aReflowReason); }; @@ -272,14 +274,15 @@ private: // non-incremental reflow command inline nsReflowState::nsReflowState(nsIFrame* aFrame, nsReflowReason aReason, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext) { NS_PRECONDITION(aReason != eReflowReason_Incremental, "unexpected reflow reason"); NS_PRECONDITION(!(aContext == nsnull), "no rendering context"); reason = aReason; reflowCommand = nsnull; - maxSize = aMaxSize; + availableWidth = aAvailableSpace.width; + availableHeight = aAvailableSpace.height; parentReflowState = nsnull; frame = aFrame; rendContext = aContext; @@ -290,13 +293,14 @@ inline nsReflowState::nsReflowState(nsIFrame* aFrame, // incremental reflow command inline nsReflowState::nsReflowState(nsIFrame* aFrame, nsIReflowCommand& aReflowCommand, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext) { NS_PRECONDITION(!(aContext == nsnull), "no rendering context"); reason = eReflowReason_Incremental; reflowCommand = &aReflowCommand; - maxSize = aMaxSize; + availableWidth = aAvailableSpace.width; + availableHeight = aAvailableSpace.height; parentReflowState = nsnull; frame = aFrame; rendContext = aContext; @@ -308,11 +312,12 @@ inline nsReflowState::nsReflowState(nsIFrame* aFrame, // from the parent's reflow state inline nsReflowState::nsReflowState(nsIFrame* aFrame, const nsReflowState& aParentReflowState, - const nsSize& aMaxSize) + const nsSize& aAvailableSpace) { reason = aParentReflowState.reason; reflowCommand = aParentReflowState.reflowCommand; - maxSize = aMaxSize; + availableWidth = aAvailableSpace.width; + availableHeight = aAvailableSpace.height; parentReflowState = &aParentReflowState; frame = aFrame; rendContext = aParentReflowState.rendContext; @@ -324,12 +329,13 @@ inline nsReflowState::nsReflowState(nsIFrame* aFrame, // sets the reflow command to NULL inline nsReflowState::nsReflowState(nsIFrame* aFrame, const nsReflowState& aParentReflowState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsReflowReason aReflowReason) { reason = aReflowReason; reflowCommand = nsnull; - maxSize = aMaxSize; + availableWidth = aAvailableSpace.width; + availableHeight = aAvailableSpace.height; parentReflowState = &aParentReflowState; frame = aFrame; rendContext = aParentReflowState.rendContext; diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index 8d9e5d65776..ecbfec97398 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -242,7 +242,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableWidth); float p2t; aPresContext.GetScaledPixelsToTwips(p2t); const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t); diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 79c38a71d06..840511818f1 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -218,7 +218,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, NS_RELEASE(browse); } - nsSize maxSize = aReflowState.maxSize; + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowMetrics desiredSize = aDesiredSize; aDesiredSize.width = CONTROL_SPACING; aDesiredSize.height = 0; diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 1582d3efc79..5e2af212569 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -601,7 +601,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, mDidInit = PR_TRUE; } - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); // reflow the child nsHTMLReflowState reflowState(aPresContext, mFirstChild, aReflowState, availSize); diff --git a/mozilla/layout/forms/nsLegendFrame.cpp b/mozilla/layout/forms/nsLegendFrame.cpp index 868e87b7468..1186f2b5cdd 100644 --- a/mozilla/layout/forms/nsLegendFrame.cpp +++ b/mozilla/layout/forms/nsLegendFrame.cpp @@ -123,7 +123,7 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); // reflow the child nsHTMLReflowState reflowState(aPresContext, mFirstChild, aReflowState, diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index ff5dc20a4d9..90ce7d42187 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -241,8 +241,8 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsAreaFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); nsresult rv = NS_OK; @@ -587,10 +587,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte "unexpected offset type"); // Percentage values refer to the width of the containing block. If the // width is unconstrained then just use 0 - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.x = 0; } else { - aRect.x = (nscoord)((float)aReflowState.maxSize.width * + aRect.x = (nscoord)((float)aReflowState.availableWidth * aPosition->mLeftOffset.GetPercentValue()); } } @@ -607,10 +607,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte "unexpected offset type"); // Percentage values refer to the height of the containing block. If the // height is unconstrained then interpret it like 'auto' - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.y = offset.y; } else { - aRect.y = (nscoord)((float)aReflowState.maxSize.height * + aRect.y = (nscoord)((float)aReflowState.availableHeight * aPosition->mTopOffset.GetPercentValue()); } } @@ -622,17 +622,17 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte // width if (eStyleUnit_Auto == aPosition->mWidth.GetUnit()) { // Use the right-edge of the containing block - aRect.width = aReflowState.maxSize.width - aRect.x; + aRect.width = aReflowState.availableWidth - aRect.x; } else if (eStyleUnit_Coord == aPosition->mWidth.GetUnit()) { aRect.width = aPosition->mWidth.GetCoordValue(); } else { NS_ASSERTION(eStyleUnit_Percent == aPosition->mWidth.GetUnit(), "unexpected width type"); // Percentage values refer to the width of the containing block - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.width = NS_UNCONSTRAINEDSIZE; } else { - aRect.width = (nscoord)((float)aReflowState.maxSize.width * + aRect.width = (nscoord)((float)aReflowState.availableWidth * aPosition->mWidth.GetPercentValue()); } } @@ -649,10 +649,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte // Percentage values refer to the height of the containing block. If the // height is unconstrained, then interpret it like 'auto' and make the // height unconstrained - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.height = NS_UNCONSTRAINEDSIZE; } else { - aRect.height = (nscoord)((float)aReflowState.maxSize.height * + aRect.height = (nscoord)((float)aReflowState.availableHeight * aPosition->mHeight.GetPercentValue()); } } diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index f399adf3815..c96a0c61699 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -304,18 +304,16 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, - aReflowState.reason)); + aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason)); if (IsInline()) { GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); } else { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; } if (nsnull == mFirstChild) { @@ -729,11 +727,10 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("InnerFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameInnerFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); nsresult rv = NS_OK; @@ -748,9 +745,10 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, nsSize size; // if the size is not 0 and there is a src, create the web shell - if ((aReflowState.maxSize.width >= 0) && (aReflowState.maxSize.height >= 0) && hasURL) { + if ((aReflowState.availableWidth >= 0) && (aReflowState.availableHeight >= 0) && hasURL) { if (nsnull == mWebShell) { - rv = CreateWebShell(aPresContext, aReflowState.maxSize); + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); + rv = CreateWebShell(aPresContext, maxSize); } if (nsnull != mWebShell) { @@ -768,8 +766,8 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, NS_RELEASE(content); } - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 4e600534a23..ab8e53631dc 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -807,7 +807,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("FramesetFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("FramesetFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); return Reflow(aPresContext, nsnull, aDesiredSize, aReflowState, aStatus); } @@ -822,7 +822,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); // Always get the size so that the caller knows how big we are GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); @@ -856,10 +856,10 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, } PRInt32 numCells = mNumRows*mNumCols; - nscoord width = (aDesiredSize.width <= aReflowState.maxSize.width) - ? aDesiredSize.width : aReflowState.maxSize.width; - nscoord height = (aDesiredSize.height <= aReflowState.maxSize.height) - ? aDesiredSize.height : aReflowState.maxSize.height; + nscoord width = (aDesiredSize.width <= aReflowState.availableWidth) + ? aDesiredSize.width : aReflowState.availableWidth; + nscoord height = (aDesiredSize.height <= aReflowState.availableHeight) + ? aDesiredSize.height : aReflowState.availableHeight; // subtract out the width of all of the potential borders. There are // only borders between s. There are none on the edges (e.g the // leftmost has no left border). @@ -1458,8 +1458,8 @@ void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.width; aDesiredSize.descent = 0; } @@ -1481,7 +1481,6 @@ nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("BorderFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); aStatus = NS_FRAME_COMPLETE; return NS_OK; @@ -1638,8 +1637,8 @@ void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.width; aDesiredSize.descent = 0; } diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 4a9f856121d..a790a36fefd 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -171,7 +171,7 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // We must pass in that the available height is unconstrained, because // constrained is only for when we're paginated... nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, - nsSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE)); + nsSize(aReflowState.availableWidth, NS_UNCONSTRAINEDSIZE)); if (isChildInitialReflow) { kidReflowState.reason = eReflowReason_Initial; kidReflowState.reflowCommand = nsnull; @@ -180,7 +180,7 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // For a height that's 'auto', make the frame as big as the available space // minus and top and bottom margins if (NS_AUTOHEIGHT == kidReflowState.computedHeight) { - kidReflowState.computedHeight = aReflowState.maxSize.height - + kidReflowState.computedHeight = aReflowState.availableHeight - kidReflowState.computedTopMargin - kidReflowState.computedTopMargin; // Computed height is for the content area so reduce it by the amount of @@ -206,14 +206,14 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // If this is a resize reflow then do a repaint if (eReflowReason_Resize == aReflowState.reason) { - nsRect damageRect(0, 0, aReflowState.maxSize.width, aReflowState.maxSize.height); + nsRect damageRect(0, 0, aReflowState.availableWidth, aReflowState.availableHeight); Invalidate(damageRect, PR_FALSE); } } // Return the max size as our desired size - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 468e67ae53f..e0ed0459b6c 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -246,8 +246,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // If this is the root frame then set the computed width and // height equal to the available space if (nsnull == parentReflowState) { - computedWidth = maxSize.width; - computedHeight = maxSize.height; + computedWidth = availableWidth; + computedHeight = availableHeight; } else { // Get the containing block reflow state @@ -269,8 +269,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // containing block (e.g., for scrolled elements because we subtract for // the scrollbar width). // XXX Don't do this if the max width is 0, which is the case for floaters... - if ((maxSize.width < containingBlockWidth) && (maxSize.width > 0)) { - containingBlockWidth = maxSize.width; + if ((availableWidth < containingBlockWidth) && (availableWidth > 0)) { + containingBlockWidth = availableWidth; } // Check for a percentage based height @@ -337,7 +337,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // Internal table elements don't have margins, but they have border // and padding - computedWidth = maxSize.width - borderPadding.left - borderPadding.right; + computedWidth = availableWidth - borderPadding.left - borderPadding.right; } else { ComputeHorizontalValue(containingBlockWidth, widthUnit, pos->mWidth, computedWidth); diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index db738070f65..07f456551db 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -437,7 +437,7 @@ nsImageFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsImageFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); diff --git a/mozilla/layout/generic/nsLeafFrame.cpp b/mozilla/layout/generic/nsLeafFrame.cpp index 054405e09ad..0c3b81a2ee0 100644 --- a/mozilla/layout/generic/nsLeafFrame.cpp +++ b/mozilla/layout/generic/nsLeafFrame.cpp @@ -60,7 +60,7 @@ nsLeafFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index e0ed34dc43d..e8b23b90181 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -49,7 +49,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Dispatch the reflow command to our content child. Allow it to be as high // as it wants - nsSize maxSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE); + nsSize maxSize(aReflowState.availableWidth, NS_UNCONSTRAINEDSIZE); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, maxSize); @@ -58,8 +58,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child. Make sure the child is at least as // tall as our max size (the containing window) - if (aDesiredSize.height < aReflowState.maxSize.height) { - aDesiredSize.height = aReflowState.maxSize.height; + if (aDesiredSize.height < aReflowState.availableHeight) { + aDesiredSize.height = aReflowState.availableHeight; } nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); @@ -84,8 +84,9 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Resize our frame allowing it only to be as big as we are // XXX Pay attention to the page's border and padding... if (nsnull != mFirstChild) { + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, - aReflowState.maxSize); + maxSize); kidReflowState.isTopOfPage = PR_TRUE; nsIHTMLReflow* htmlReflow; @@ -94,8 +95,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, ReflowChild(mFirstChild, aPresContext, aDesiredSize, kidReflowState, aStatus); // Make sure the child is at least as tall as our max size (the containing window) - if (aDesiredSize.height < aReflowState.maxSize.height) { - aDesiredSize.height = aReflowState.maxSize.height; + if (aDesiredSize.height < aReflowState.availableHeight) { + aDesiredSize.height = aReflowState.availableHeight; } // Place and size the child @@ -115,8 +116,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, } // Return our desired size - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; } return NS_OK; diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 851e0c76992..32da367e450 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -60,7 +60,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, // Compute the size of each page and the x coordinate that each page will // be placed at nsSize pageSize(aPresContext.GetPageWidth(), aPresContext.GetPageHeight()); - PRInt32 extra = aReflowState.maxSize.width - 2*PAGE_SPACING_TWIPS - pageSize.width; + PRInt32 extra = aReflowState.availableWidth - 2 * PAGE_SPACING_TWIPS - pageSize.width; // Note: nscoord is an unsigned type so don't combine these // two statements or the extra will be promoted to unsigned diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 2f12e85ee51..dde903c1acd 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -1658,7 +1658,7 @@ TextFrame::Reflow(nsIPresContext& aPresContext, // NS_PRECONDITION(nsnull != aReflowState.lineLayout, "no line layout"); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter TextFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); // XXX If there's no line layout, we shouldn't even have created this // frame. This may happen if, for example, this is text inside a table @@ -1706,7 +1706,7 @@ TextFrame::Reflow(nsIPresContext& aPresContext, } nscoord x = 0; - nscoord maxWidth = aReflowState.maxSize.width; + nscoord maxWidth = aReflowState.availableWidth; nscoord maxWordWidth = 0; nscoord prevMaxWordWidth = 0; PRBool endsInWhitespace = PR_FALSE; diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index ff5dc20a4d9..90ce7d42187 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -241,8 +241,8 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsAreaFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); nsresult rv = NS_OK; @@ -587,10 +587,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte "unexpected offset type"); // Percentage values refer to the width of the containing block. If the // width is unconstrained then just use 0 - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.x = 0; } else { - aRect.x = (nscoord)((float)aReflowState.maxSize.width * + aRect.x = (nscoord)((float)aReflowState.availableWidth * aPosition->mLeftOffset.GetPercentValue()); } } @@ -607,10 +607,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte "unexpected offset type"); // Percentage values refer to the height of the containing block. If the // height is unconstrained then interpret it like 'auto' - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.y = offset.y; } else { - aRect.y = (nscoord)((float)aReflowState.maxSize.height * + aRect.y = (nscoord)((float)aReflowState.availableHeight * aPosition->mTopOffset.GetPercentValue()); } } @@ -622,17 +622,17 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte // width if (eStyleUnit_Auto == aPosition->mWidth.GetUnit()) { // Use the right-edge of the containing block - aRect.width = aReflowState.maxSize.width - aRect.x; + aRect.width = aReflowState.availableWidth - aRect.x; } else if (eStyleUnit_Coord == aPosition->mWidth.GetUnit()) { aRect.width = aPosition->mWidth.GetCoordValue(); } else { NS_ASSERTION(eStyleUnit_Percent == aPosition->mWidth.GetUnit(), "unexpected width type"); // Percentage values refer to the width of the containing block - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.width = NS_UNCONSTRAINEDSIZE; } else { - aRect.width = (nscoord)((float)aReflowState.maxSize.width * + aRect.width = (nscoord)((float)aReflowState.availableWidth * aPosition->mWidth.GetPercentValue()); } } @@ -649,10 +649,10 @@ void nsAreaFrame::ComputeAbsoluteFrameBounds(nsIPresContext& aPresConte // Percentage values refer to the height of the containing block. If the // height is unconstrained, then interpret it like 'auto' and make the // height unconstrained - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.height = NS_UNCONSTRAINEDSIZE; } else { - aRect.height = (nscoord)((float)aReflowState.maxSize.height * + aRect.height = (nscoord)((float)aReflowState.availableHeight * aPosition->mHeight.GetPercentValue()); } } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 2b5dcd052db..7d75e5f3e95 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -305,24 +305,22 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mRunInToFrame = nsnull; mY = mAscent = mDescent = 0; - mUnconstrainedWidth = maxSize.width == NS_UNCONSTRAINEDSIZE; - mUnconstrainedHeight = maxSize.height == NS_UNCONSTRAINEDSIZE; + mUnconstrainedWidth = availableWidth == NS_UNCONSTRAINEDSIZE; + mUnconstrainedHeight = availableHeight == NS_UNCONSTRAINEDSIZE; #ifdef NS_DEBUG - if (!mUnconstrainedWidth && (maxSize.width > 100000)) { + if (!mUnconstrainedWidth && (availableWidth > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.width > 100000) { - maxSize.width = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableWidth > 100000) { + availableWidth = NS_UNCONSTRAINEDSIZE; mUnconstrainedWidth = PR_TRUE; } } - if (!mUnconstrainedHeight && (maxSize.height > 100000)) { + if (!mUnconstrainedHeight && (availableHeight > 100000)) { mBlock->ListTag(stdout); - printf(": bad parent: maxSize WAS %d,%d\n", - maxSize.width, maxSize.height); - if (maxSize.height > 100000) { - maxSize.height = NS_UNCONSTRAINEDSIZE; + printf(": bad parent: maxSize WAS %d,%d\n", availableWidth, availableHeight); + if (availableHeight > 100000) { + availableHeight = NS_UNCONSTRAINEDSIZE; mUnconstrainedHeight = PR_TRUE; } } @@ -346,14 +344,14 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, mContentArea.width = NS_UNCONSTRAINEDSIZE; } else { - mBorderArea.width = maxSize.width; - mContentArea.width = maxSize.width - lr; + mBorderArea.width = availableWidth; + mContentArea.width = availableWidth - lr; } } - mBorderArea.height = maxSize.height; - mContentArea.height = maxSize.height; - mBottomEdge = maxSize.height; + mBorderArea.height = availableHeight; + mContentArea.height = availableHeight; + mBottomEdge = availableHeight; if (!mUnconstrainedHeight) { mBottomEdge -= mBorderPadding.bottom; } @@ -686,8 +684,8 @@ nsBaseIBFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBaseIBFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // XXX subclass! @@ -837,8 +835,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, !compact) { // Fluff out to the max width if we aren't already that wide if (0 == (BLOCK_IS_INLINE & mFlags)) { - if (computedWidth < aState.maxSize.width) { - computedWidth = aState.maxSize.width; + if (computedWidth < aState.availableWidth) { + computedWidth = aState.availableWidth; } } } @@ -932,7 +930,7 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState, ListTag(stdout); printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, - aState.maxSize.width, aState.maxSize.height); + aState.availableWidth, aState.availableHeight); #endif } @@ -3594,11 +3592,10 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - nsSize& kidAvailSize = aFloaterReflowState.maxSize; if (aFloaterReflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. - kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right; + aFloaterReflowState.availableWidth = aFloaterReflowState.computedWidth + bp.left + bp.right; } else { // CSS2 section 10.3.5: Floating non-replaced elements with an @@ -3613,15 +3610,15 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext, return; } } - kidAvailSize.width = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; } // Compute the available height for the floater if (aFloaterReflowState.HaveFixedContentHeight()) { - kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom; + aFloaterReflowState.availableHeight = aFloaterReflowState.computedHeight + bp.top + bp.bottom; } else { - kidAvailSize.height = NS_UNCONSTRAINEDSIZE; + aFloaterReflowState.availableHeight = NS_UNCONSTRAINEDSIZE; } // Resize reflow the anchored item into the available space diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index fd17077f46b..7eca1f4b6f9 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -226,8 +226,8 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsBodyFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); // Make a copy of the reflow state so we can set the space manager @@ -647,10 +647,10 @@ void nsBodyFrame::ComputeAbsoluteFrameBounds(nsIFrame* aAnchorFra "unexpected offset type"); // Percentage values refer to the width of the containing block. If the // width is unconstrained then just use 0 - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.x = 0; } else { - aRect.x = (nscoord)((float)aReflowState.maxSize.width * + aRect.x = (nscoord)((float)aReflowState.availableWidth * aPosition->mLeftOffset.GetPercentValue()); } } @@ -667,10 +667,10 @@ void nsBodyFrame::ComputeAbsoluteFrameBounds(nsIFrame* aAnchorFra "unexpected offset type"); // Percentage values refer to the height of the containing block. If the // height is unconstrained then interpret it like 'auto' - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.y = offset.y; } else { - aRect.y = (nscoord)((float)aReflowState.maxSize.height * + aRect.y = (nscoord)((float)aReflowState.availableHeight * aPosition->mTopOffset.GetPercentValue()); } } @@ -682,17 +682,17 @@ void nsBodyFrame::ComputeAbsoluteFrameBounds(nsIFrame* aAnchorFra // width if (eStyleUnit_Auto == aPosition->mWidth.GetUnit()) { // Use the right-edge of the containing block - aRect.width = aReflowState.maxSize.width; + aRect.width = aReflowState.availableWidth; } else if (eStyleUnit_Coord == aPosition->mWidth.GetUnit()) { aRect.width = aPosition->mWidth.GetCoordValue(); } else { NS_ASSERTION(eStyleUnit_Percent == aPosition->mWidth.GetUnit(), "unexpected width type"); // Percentage values refer to the width of the containing block - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aRect.width = NS_UNCONSTRAINEDSIZE; } else { - aRect.width = (nscoord)((float)aReflowState.maxSize.width * + aRect.width = (nscoord)((float)aReflowState.availableWidth * aPosition->mWidth.GetPercentValue()); } } @@ -709,10 +709,10 @@ void nsBodyFrame::ComputeAbsoluteFrameBounds(nsIFrame* aAnchorFra // Percentage values refer to the height of the containing block. If the // height is unconstrained, then interpret it like 'auto' and make the // height unconstrained - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.height) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) { aRect.height = NS_UNCONSTRAINEDSIZE; } else { - aRect.height = (nscoord)((float)aReflowState.maxSize.height * + aRect.height = (nscoord)((float)aReflowState.availableHeight * aPosition->mHeight.GetPercentValue()); } } diff --git a/mozilla/layout/html/base/src/nsFrameReflowState.cpp b/mozilla/layout/html/base/src/nsFrameReflowState.cpp index 468e67ae53f..e0ed0459b6c 100644 --- a/mozilla/layout/html/base/src/nsFrameReflowState.cpp +++ b/mozilla/layout/html/base/src/nsFrameReflowState.cpp @@ -246,8 +246,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // If this is the root frame then set the computed width and // height equal to the available space if (nsnull == parentReflowState) { - computedWidth = maxSize.width; - computedHeight = maxSize.height; + computedWidth = availableWidth; + computedHeight = availableHeight; } else { // Get the containing block reflow state @@ -269,8 +269,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // containing block (e.g., for scrolled elements because we subtract for // the scrollbar width). // XXX Don't do this if the max width is 0, which is the case for floaters... - if ((maxSize.width < containingBlockWidth) && (maxSize.width > 0)) { - containingBlockWidth = maxSize.width; + if ((availableWidth < containingBlockWidth) && (availableWidth > 0)) { + containingBlockWidth = availableWidth; } // Check for a percentage based height @@ -337,7 +337,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // Internal table elements don't have margins, but they have border // and padding - computedWidth = maxSize.width - borderPadding.left - borderPadding.right; + computedWidth = availableWidth - borderPadding.left - borderPadding.right; } else { ComputeHorizontalValue(containingBlockWidth, widthUnit, pos->mWidth, computedWidth); diff --git a/mozilla/layout/html/base/src/nsHRFrame.cpp b/mozilla/layout/html/base/src/nsHRFrame.cpp index cd076c7c2d3..2ddef50a286 100644 --- a/mozilla/layout/html/base/src/nsHRFrame.cpp +++ b/mozilla/layout/html/base/src/nsHRFrame.cpp @@ -268,17 +268,17 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext, aDesiredSize.width = aReflowState.computedWidth; } else { - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { aDesiredSize.width = nscoord(p2t); } else { - aDesiredSize.width = aReflowState.maxSize.width; + aDesiredSize.width = aReflowState.availableWidth; } } mComputedWidth = aDesiredSize.width; - if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) { - if (aDesiredSize.width < aReflowState.maxSize.width) { - aDesiredSize.width = aReflowState.maxSize.width; + if (aReflowState.availableWidth != NS_UNCONSTRAINEDSIZE) { + if (aDesiredSize.width < aReflowState.availableWidth) { + aDesiredSize.width = aReflowState.availableWidth; } } diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 4a9f856121d..a790a36fefd 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -171,7 +171,7 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // We must pass in that the available height is unconstrained, because // constrained is only for when we're paginated... nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, - nsSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE)); + nsSize(aReflowState.availableWidth, NS_UNCONSTRAINEDSIZE)); if (isChildInitialReflow) { kidReflowState.reason = eReflowReason_Initial; kidReflowState.reflowCommand = nsnull; @@ -180,7 +180,7 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // For a height that's 'auto', make the frame as big as the available space // minus and top and bottom margins if (NS_AUTOHEIGHT == kidReflowState.computedHeight) { - kidReflowState.computedHeight = aReflowState.maxSize.height - + kidReflowState.computedHeight = aReflowState.availableHeight - kidReflowState.computedTopMargin - kidReflowState.computedTopMargin; // Computed height is for the content area so reduce it by the amount of @@ -206,14 +206,14 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // If this is a resize reflow then do a repaint if (eReflowReason_Resize == aReflowState.reason) { - nsRect damageRect(0, 0, aReflowState.maxSize.width, aReflowState.maxSize.height); + nsRect damageRect(0, 0, aReflowState.availableWidth, aReflowState.availableHeight); Invalidate(damageRect, PR_FALSE); } } // Return the max size as our desired size - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 468e67ae53f..e0ed0459b6c 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -246,8 +246,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // If this is the root frame then set the computed width and // height equal to the available space if (nsnull == parentReflowState) { - computedWidth = maxSize.width; - computedHeight = maxSize.height; + computedWidth = availableWidth; + computedHeight = availableHeight; } else { // Get the containing block reflow state @@ -269,8 +269,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // containing block (e.g., for scrolled elements because we subtract for // the scrollbar width). // XXX Don't do this if the max width is 0, which is the case for floaters... - if ((maxSize.width < containingBlockWidth) && (maxSize.width > 0)) { - containingBlockWidth = maxSize.width; + if ((availableWidth < containingBlockWidth) && (availableWidth > 0)) { + containingBlockWidth = availableWidth; } // Check for a percentage based height @@ -337,7 +337,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) // Internal table elements don't have margins, but they have border // and padding - computedWidth = maxSize.width - borderPadding.left - borderPadding.right; + computedWidth = availableWidth - borderPadding.left - borderPadding.right; } else { ComputeHorizontalValue(containingBlockWidth, widthUnit, pos->mWidth, computedWidth); diff --git a/mozilla/layout/html/base/src/nsIHTMLReflow.h b/mozilla/layout/html/base/src/nsIHTMLReflow.h index 426adbcdde3..56dd80db832 100644 --- a/mozilla/layout/html/base/src/nsIHTMLReflow.h +++ b/mozilla/layout/html/base/src/nsIHTMLReflow.h @@ -171,7 +171,7 @@ struct nsHTMLReflowState : nsReflowState { nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, nsReflowReason aReason, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext, nsISpaceManager* aSpaceManager = nsnull); @@ -180,7 +180,7 @@ struct nsHTMLReflowState : nsReflowState { nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIReflowCommand& aReflowCommand, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext, nsISpaceManager* aSpaceManager = nsnull); @@ -191,7 +191,7 @@ struct nsHTMLReflowState : nsReflowState { nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentReflowState, - const nsSize& aMaxSize); + const nsSize& aAvailableSpace); // Construct a reflow state for the given inline frame, parent // reflow state, and max size. Uses the reflow reason, space @@ -200,7 +200,7 @@ struct nsHTMLReflowState : nsReflowState { nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentReflowState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsLineLayout* aLineLayout); // Constructs a reflow state that overrides the reflow reason of the parent @@ -210,7 +210,7 @@ struct nsHTMLReflowState : nsReflowState { nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentReflowState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsReflowReason aReflowReason); /** @@ -420,10 +420,10 @@ inline nsHTMLReflowState::nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, nsReflowReason aReason, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext, nsISpaceManager* aSpaceManager) - : nsReflowState(aFrame, aReason, aMaxSize, aContext) + : nsReflowState(aFrame, aReason, aAvailableSpace, aContext) { spaceManager = aSpaceManager; lineLayout = nsnull; @@ -436,10 +436,10 @@ inline nsHTMLReflowState::nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIReflowCommand& aReflowCommand, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsIRenderingContext* aContext, nsISpaceManager* aSpaceManager) - : nsReflowState(aFrame, aReflowCommand, aMaxSize, aContext) + : nsReflowState(aFrame, aReflowCommand, aAvailableSpace, aContext) { spaceManager = aSpaceManager; lineLayout = nsnull; @@ -454,8 +454,8 @@ inline nsHTMLReflowState::nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentState, - const nsSize& aMaxSize) - : nsReflowState(aFrame, aParentState, aMaxSize) + const nsSize& aAvailableSpace) + : nsReflowState(aFrame, aParentState, aAvailableSpace) { spaceManager = aParentState.spaceManager; lineLayout = aParentState.lineLayout; @@ -469,9 +469,9 @@ inline nsHTMLReflowState::nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsLineLayout* aLineLayout) - : nsReflowState(aFrame, aParentState, aMaxSize) + : nsReflowState(aFrame, aParentState, aAvailableSpace) { spaceManager = aParentState.spaceManager; lineLayout = aLineLayout; @@ -486,9 +486,9 @@ inline nsHTMLReflowState::nsHTMLReflowState(nsIPresContext& aPresContext, nsIFrame* aFrame, const nsHTMLReflowState& aParentState, - const nsSize& aMaxSize, + const nsSize& aAvailableSpace, nsReflowReason aReflowReason) - : nsReflowState(aFrame, aParentState, aMaxSize, aReflowReason) + : nsReflowState(aFrame, aParentState, aAvailableSpace, aReflowReason) { spaceManager = aParentState.spaceManager; lineLayout = nsnull; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index db738070f65..07f456551db 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -437,7 +437,7 @@ nsImageFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsImageFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); diff --git a/mozilla/layout/html/base/src/nsInlineReflow.cpp b/mozilla/layout/html/base/src/nsInlineReflow.cpp index 02fb7f77f9c..0f27307be85 100644 --- a/mozilla/layout/html/base/src/nsInlineReflow.cpp +++ b/mozilla/layout/html/base/src/nsInlineReflow.cpp @@ -360,7 +360,7 @@ nsInlineReflow::ComputeAvailableSize() pfd->mMargin.bottom; } if (mOuterReflowState.mNoWrap) { - mFrameAvailSize.width = mOuterReflowState.maxSize.width; + mFrameAvailSize.width = mOuterReflowState.availableWidth; return PR_TRUE; } diff --git a/mozilla/layout/html/base/src/nsLeafFrame.cpp b/mozilla/layout/html/base/src/nsLeafFrame.cpp index 054405e09ad..0c3b81a2ee0 100644 --- a/mozilla/layout/html/base/src/nsLeafFrame.cpp +++ b/mozilla/layout/html/base/src/nsLeafFrame.cpp @@ -60,7 +60,7 @@ nsLeafFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index e0ed34dc43d..e8b23b90181 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -49,7 +49,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Dispatch the reflow command to our content child. Allow it to be as high // as it wants - nsSize maxSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE); + nsSize maxSize(aReflowState.availableWidth, NS_UNCONSTRAINEDSIZE); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, maxSize); @@ -58,8 +58,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child. Make sure the child is at least as // tall as our max size (the containing window) - if (aDesiredSize.height < aReflowState.maxSize.height) { - aDesiredSize.height = aReflowState.maxSize.height; + if (aDesiredSize.height < aReflowState.availableHeight) { + aDesiredSize.height = aReflowState.availableHeight; } nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); @@ -84,8 +84,9 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Resize our frame allowing it only to be as big as we are // XXX Pay attention to the page's border and padding... if (nsnull != mFirstChild) { + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, - aReflowState.maxSize); + maxSize); kidReflowState.isTopOfPage = PR_TRUE; nsIHTMLReflow* htmlReflow; @@ -94,8 +95,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, ReflowChild(mFirstChild, aPresContext, aDesiredSize, kidReflowState, aStatus); // Make sure the child is at least as tall as our max size (the containing window) - if (aDesiredSize.height < aReflowState.maxSize.height) { - aDesiredSize.height = aReflowState.maxSize.height; + if (aDesiredSize.height < aReflowState.availableHeight) { + aDesiredSize.height = aReflowState.availableHeight; } // Place and size the child @@ -115,8 +116,8 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, } // Return our desired size - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; } return NS_OK; diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index e2e50434acb..e8af94d4121 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -241,8 +241,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, { NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, ("enter nsScrollFrame::Reflow: maxSize=%d,%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height)); + aReflowState.availableWidth, + aReflowState.availableHeight)); nsIFrame* targetFrame; nsIFrame* nextFrame; @@ -303,7 +303,7 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // We have an 'auto' height and so we should shrink wrap around the // scrolled frame. Let the scrolled frame be as high as the available // height - scrollAreaSize.height = aReflowState.maxSize.height; + scrollAreaSize.height = aReflowState.availableHeight; scrollAreaSize.height -= border.top + border.bottom; // XXX Check for min/max limits... diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 851e0c76992..32da367e450 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -60,7 +60,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, // Compute the size of each page and the x coordinate that each page will // be placed at nsSize pageSize(aPresContext.GetPageWidth(), aPresContext.GetPageHeight()); - PRInt32 extra = aReflowState.maxSize.width - 2*PAGE_SPACING_TWIPS - pageSize.width; + PRInt32 extra = aReflowState.availableWidth - 2 * PAGE_SPACING_TWIPS - pageSize.width; // Note: nscoord is an unsigned type so don't combine these // two statements or the extra will be promoted to unsigned diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 2f12e85ee51..dde903c1acd 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -1658,7 +1658,7 @@ TextFrame::Reflow(nsIPresContext& aPresContext, // NS_PRECONDITION(nsnull != aReflowState.lineLayout, "no line layout"); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter TextFrame::Reflow: aMaxSize=%d,%d", - aReflowState.maxSize.width, aReflowState.maxSize.height)); + aReflowState.availableWidth, aReflowState.availableHeight)); // XXX If there's no line layout, we shouldn't even have created this // frame. This may happen if, for example, this is text inside a table @@ -1706,7 +1706,7 @@ TextFrame::Reflow(nsIPresContext& aPresContext, } nscoord x = 0; - nscoord maxWidth = aReflowState.maxSize.width; + nscoord maxWidth = aReflowState.availableWidth; nscoord maxWordWidth = 0; nscoord prevMaxWordWidth = 0; PRBool endsInWhitespace = PR_FALSE; diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index f399adf3815..c96a0c61699 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -304,18 +304,16 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, - aReflowState.reason)); + aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason)); if (IsInline()) { GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); } else { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; } if (nsnull == mFirstChild) { @@ -729,11 +727,10 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("InnerFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameInnerFrame::Reflow: maxSize=%d,%d reason=%d", - aReflowState.maxSize.width, - aReflowState.maxSize.height, + aReflowState.availableWidth, + aReflowState.availableHeight, aReflowState.reason)); nsresult rv = NS_OK; @@ -748,9 +745,10 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, nsSize size; // if the size is not 0 and there is a src, create the web shell - if ((aReflowState.maxSize.width >= 0) && (aReflowState.maxSize.height >= 0) && hasURL) { + if ((aReflowState.availableWidth >= 0) && (aReflowState.availableHeight >= 0) && hasURL) { if (nsnull == mWebShell) { - rv = CreateWebShell(aPresContext, aReflowState.maxSize); + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); + rv = CreateWebShell(aPresContext, maxSize); } if (nsnull != mWebShell) { @@ -768,8 +766,8 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, NS_RELEASE(content); } - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 4e600534a23..ab8e53631dc 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -807,7 +807,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("FramesetFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("FramesetFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); return Reflow(aPresContext, nsnull, aDesiredSize, aReflowState, aStatus); } @@ -822,7 +822,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); + //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); // Always get the size so that the caller knows how big we are GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); @@ -856,10 +856,10 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, } PRInt32 numCells = mNumRows*mNumCols; - nscoord width = (aDesiredSize.width <= aReflowState.maxSize.width) - ? aDesiredSize.width : aReflowState.maxSize.width; - nscoord height = (aDesiredSize.height <= aReflowState.maxSize.height) - ? aDesiredSize.height : aReflowState.maxSize.height; + nscoord width = (aDesiredSize.width <= aReflowState.availableWidth) + ? aDesiredSize.width : aReflowState.availableWidth; + nscoord height = (aDesiredSize.height <= aReflowState.availableHeight) + ? aDesiredSize.height : aReflowState.availableHeight; // subtract out the width of all of the potential borders. There are // only borders between s. There are none on the edges (e.g the // leftmost has no left border). @@ -1458,8 +1458,8 @@ void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.width; aDesiredSize.descent = 0; } @@ -1481,7 +1481,6 @@ nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - //printf("BorderFrame::Reflow %X (%d,%d) \n", this, aReflowState.maxSize.width, aReflowState.maxSize.height); GetDesiredSize(&aPresContext, aReflowState, aDesiredSize); aStatus = NS_FRAME_COMPLETE; return NS_OK; @@ -1638,8 +1637,8 @@ void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - aDesiredSize.width = aReflowState.maxSize.width; - aDesiredSize.height = aReflowState.maxSize.height; + aDesiredSize.width = aReflowState.availableWidth; + aDesiredSize.height = aReflowState.availableHeight; aDesiredSize.ascent = aDesiredSize.width; aDesiredSize.descent = 0; } diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index 8d9e5d65776..ecbfec97398 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -242,7 +242,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableWidth); float p2t; aPresContext.GetScaledPixelsToTwips(p2t); const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 79c38a71d06..840511818f1 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -218,7 +218,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, NS_RELEASE(browse); } - nsSize maxSize = aReflowState.maxSize; + nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowMetrics desiredSize = aDesiredSize; aDesiredSize.width = CONTROL_SPACING; aDesiredSize.height = 0; diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 1582d3efc79..5e2af212569 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -601,7 +601,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, mDidInit = PR_TRUE; } - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); // reflow the child nsHTMLReflowState reflowState(aPresContext, mFirstChild, aReflowState, availSize); diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index dc4ae35c35e..d3975ad482f 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -423,7 +423,7 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, } } - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); // reflow the child nsHTMLReflowState reflowState(aPresContext, mFirstChild, aReflowState, availSize); diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.cpp b/mozilla/layout/html/forms/src/nsLegendFrame.cpp index 868e87b7468..1186f2b5cdd 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLegendFrame.cpp @@ -123,7 +123,7 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); // reflow the child nsHTMLReflowState reflowState(aPresContext, mFirstChild, aReflowState, diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 083a8532d42..a30e255f889 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -344,12 +344,12 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, aStatus = NS_FRAME_COMPLETE; if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT) printf("%p nsTableCellFrame::Reflow: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); nsSize maxElementSize; nsSize *pMaxElementSize = aDesiredSize.maxElementSize; - if (NS_UNCONSTRAINEDSIZE==aReflowState.maxSize.width) + if (NS_UNCONSTRAINEDSIZE==aReflowState.availableWidth) pMaxElementSize = &maxElementSize; nscoord x = 0; // SEC: what about ascent and decent??? @@ -417,7 +417,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, availSize.width, availSize.height); nsHTMLReflowMetrics kidSize(pMaxElementSize); kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; - SetPriorAvailWidth(aReflowState.maxSize.width); + SetPriorAvailWidth(aReflowState.availableWidth); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, availSize); @@ -456,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, if (gsDebug) printf ("setting initial child width from 0 to %d for nav4 compatibility\n", NSIntPixelsToTwips(4, p2t)); } else // empty content has to be forced to the assigned width for resize or incremental reflow - kidSize.width = kidReflowState.maxSize.width; + kidSize.width = kidReflowState.availableWidth; } if (0==kidSize.height) { diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 2145f65fe95..f7f394cd2f7 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -483,7 +483,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresC nsHTMLReflowMetrics desiredSize(nsnull); nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState, - aReflowState.maxSize); + nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); 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 7d3b3914568..56e1a888d5c 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -107,14 +107,14 @@ struct InnerTableReflowState { { y=0; // border/padding??? - unconstrainedWidth = PRBool(aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - availSize.width = aReflowState.maxSize.width; + unconstrainedWidth = PRBool(aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + availSize.width = aReflowState.availableWidth; if (!unconstrainedWidth) { availSize.width -= aBorderPadding.left + aBorderPadding.right; } - unconstrainedHeight = PRBool(aReflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); - availSize.height = aReflowState.maxSize.height; + unconstrainedHeight = PRBool(aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE); + availSize.height = aReflowState.availableHeight; if (!unconstrainedHeight) { availSize.height -= aBorderPadding.top + aBorderPadding.bottom; } @@ -2331,7 +2331,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, { printf("-----------------------------------------------------------------\n"); printf("nsTableFrame::Reflow: table %p reason %d given maxSize=%d,%d\n", - this, aReflowState.reason, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight); } // Initialize out parameter @@ -2348,7 +2348,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, } // NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow - if (PR_TRUE==NeedsReflow(aReflowState, aReflowState.maxSize)) + if (PR_TRUE==NeedsReflow(aReflowState, nsSize(aReflowState.availableWidth, aReflowState.availableHeight))) { PRBool needsRecalc=PR_FALSE; if (PR_TRUE==gsDebug || PR_TRUE==gsDebugIR) printf("TIF Reflow: needs reflow\n"); @@ -2411,7 +2411,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, if (nsnull==mPrevInFlow) { // only do this for a first-in-flow table frame // assign column widths, and assign aMaxElementSize->width - BalanceColumnWidths(aPresContext, aReflowState, aReflowState.maxSize, + BalanceColumnWidths(aPresContext, aReflowState, nsSize(aReflowState.availableWidth, aReflowState.availableHeight), aDesiredSize.maxElementSize); // assign table width @@ -2420,7 +2420,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, // Constrain our reflow width to the computed table width nsHTMLReflowState reflowState(aReflowState); - reflowState.maxSize.width = mRect.width; + reflowState.availableWidth = mRect.width; rv = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, aStatus); if (NS_FAILED(rv)) return rv; @@ -2468,7 +2468,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, NS_ASSERTION(nsnull != mContent, "null content"); if (PR_TRUE==gsDebugNT) printf("%p nsTableFrame::ResizeReflow Pass1: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); nsresult rv=NS_OK; // set out params aStatus = NS_FRAME_COMPLETE; @@ -2576,7 +2576,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass2(nsIPresContext& aPresContext, "bad parent reflow state"); if (PR_TRUE==gsDebugNT) printf("%p nsTableFrame::ResizeReflow Pass2: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); nsresult rv = NS_OK; // set out param @@ -3075,9 +3075,10 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Pass along the reflow command nsHTMLReflowMetrics desiredSize(nsnull); // XXX Correctly compute the available space... + nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, - aReflowState.reflowState.maxSize); + availSpace); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -3104,7 +3105,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, nscoord nsTableFrame::ComputeDesiredWidth(const nsHTMLReflowState& aReflowState) const { - nscoord desiredWidth=aReflowState.maxSize.width; + nscoord desiredWidth=aReflowState.availableWidth; // this is the biggest hack in the world. But there's no other rational way to handle nested percent tables const nsStylePosition* position; PRBool isNested=IsNested(aReflowState, position); @@ -4612,7 +4613,7 @@ PRBool nsTableFrame::IsNested(const nsHTMLReflowState& aReflowState, const nsSty nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowState) { const nsStyleDisplay *display; - nscoord parentWidth = aReflowState.maxSize.width; + nscoord parentWidth = aReflowState.availableWidth; // Walk up the reflow state chain until we find a block // frame. Our width is computed relative to there. @@ -4643,9 +4644,9 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta // then we can use it if (PR_FALSE==skipThisBlock) { - if (NS_UNCONSTRAINEDSIZE!=rs->maxSize.width) + if (NS_UNCONSTRAINEDSIZE!=rs->availableWidth) { - parentWidth = rs->maxSize.width; + parentWidth = rs->availableWidth; if (PR_TRUE==gsDebugNT) printf("%p: found a block frame %p, returning width %d\n", aReflowState.frame, rs->frame, parentWidth); @@ -4778,7 +4779,7 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta else { // the table has not yet been sized, so we need to infer the available space - parentWidth = rs->maxSize.width; + parentWidth = rs->availableWidth; if (eStyleUnit_Percent == tablePosition->mWidth.GetUnit()) { float percent = tablePosition->mWidth.GetPercentValue(); diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index de81ab095ce..ec79de2db05 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -74,13 +74,13 @@ struct OuterTableReflowState { : reflowState(aReflowState) { pc = &aPresContext; - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; prevMaxPosBottomMargin = 0; prevMaxNegBottomMargin = 0; y=0; // border/padding/margin??? - unconstrainedWidth = PRBool(aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - unconstrainedHeight = PRBool(aReflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); + unconstrainedWidth = PRBool(aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + unconstrainedHeight = PRBool(aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE); innerTableMaxSize.width=0; innerTableMaxSize.height=0; } @@ -179,7 +179,7 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aReflowState, mInnerTableFrame->GetSize(innerTableSize); aReflowState.innerTableMaxSize.width = innerTableSize.width; - aReflowState.innerTableMaxSize.height = aReflowState.reflowState.maxSize.height; + aReflowState.innerTableMaxSize.height = aReflowState.reflowState.availableHeight; return NS_OK; } @@ -338,7 +338,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, nsSize(mRect.width, - aReflowState.reflowState.maxSize.height), + aReflowState.reflowState.availableHeight), aReflowState.reflowState.reason); captionReflowState.reflowCommand=aReflowState.reflowState.reflowCommand; rv = ReflowChild(mCaptionFrame, aPresContext, captionSize, captionReflowState, aStatus); @@ -379,7 +379,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(tableWidth, aReflowState.reflowState.maxSize.height), + nsSize(tableWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (NS_FAILED(rv)) @@ -518,11 +518,11 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont // pass along the reflow command to the inner table if (PR_TRUE==gsDebugIR) printf("TOF IR: passing down incremental reflow command to inner table.\n"); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); - nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.maxSize.width, mMinCaptionWidth); + nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.availableWidth, mMinCaptionWidth); if (PR_TRUE==gsDebugIR) printf("TOF IR: mincaptionWidth=%d, tableMaxWidth=%d.\n", mMinCaptionWidth, tableMaxWidth); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(tableMaxWidth, aReflowState.reflowState.maxSize.height)); + nsSize(tableMaxWidth, aReflowState.reflowState.availableHeight)); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width=%d height=%d\n", rv, innerSize.width, innerSize.height); @@ -542,7 +542,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, nsSize(innerSize.width, - aReflowState.reflowState.maxSize.height), + aReflowState.reflowState.availableHeight), eReflowReason_Resize); nsIHTMLReflow* htmlReflow; if (NS_OK == mCaptionFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) @@ -662,7 +662,7 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte nsHTMLReflowMetrics captionSize(&maxElementSize); nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, - nsSize(mRect.width, aReflowState.reflowState.maxSize.height), + nsSize(mRect.width, aReflowState.reflowState.availableHeight), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -692,7 +692,7 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if (PR_TRUE==gsDebugIR) printf("TOF IR: resize-reflowing inner table\n"); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(mMinCaptionWidth, aReflowState.reflowState.maxSize.height), + nsSize(mMinCaptionWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width =%d, height = %d\n", @@ -746,8 +746,8 @@ nsresult nsTableOuterFrame::IR_CaptionRemoved(nsIPresContext& aPresContex if (PR_TRUE==gsDebugIR) printf("TOF IR: reflowing inner table\n"); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(aReflowState.reflowState.maxSize.width, - aReflowState.reflowState.maxSize.height)); + nsSize(aReflowState.reflowState.availableWidth, + aReflowState.reflowState.availableHeight)); // ReflowChild sets MES rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (NS_FAILED(rv)) @@ -845,8 +845,8 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) // Figure out the overall table width constraint. Default case, get 100% of // available space - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { - maxWidth = aReflowState.maxSize.width; + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { + maxWidth = aReflowState.availableWidth; } else { const nsStylePosition* position = @@ -857,19 +857,19 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) maxWidth = position->mWidth.GetCoordValue(); // NAV4 compatibility: 0-coord-width == auto-width if (0==maxWidth) - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Auto: - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Percent: - maxWidth = (nscoord)((float)aReflowState.maxSize.width * + maxWidth = (nscoord)((float)aReflowState.availableWidth * position->mWidth.GetPercentValue()); // NAV4 compatibility: 0-percent-width == auto-width if (0==maxWidth) - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Proportional: @@ -877,7 +877,7 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) // XXX for now these fall through default: - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; } @@ -920,7 +920,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, nsresult rv = NS_OK; if (PR_TRUE==gsDebug) printf("%p: nsTableOuterFrame::Reflow : maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); PRIntervalTime startTime; if (gsTiming) { @@ -984,7 +984,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, // First reflow the inner table nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState, - nsSize(tableWidth, aReflowState.maxSize.height)); + nsSize(tableWidth, aReflowState.availableHeight)); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index a4b2dfbfe7d..f5f0d64af8f 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -68,8 +68,8 @@ struct RowReflowState { nsTableFrame* aTableFrame) : reflowState(aReflowState) { - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; maxCellHeight = 0; maxCellVertSpace = 0; tableFrame = aTableFrame; @@ -572,7 +572,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, // cell frame has a next-in-flow nsIFrame* kidNextInFlow; kidFrame->GetNextInFlow(kidNextInFlow); - if ((aReflowState.reflowState.maxSize.height != NS_UNCONSTRAINEDSIZE) || + if ((aReflowState.reflowState.availableHeight != NS_UNCONSTRAINEDSIZE) || (availWidth != ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth()) || (nsnull != kidNextInFlow)) { @@ -584,7 +584,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsSize kidAvailSize(availWidth, NS_UNCONSTRAINEDSIZE); #else // Reflow the cell to fit the available height - nsSize kidAvailSize(availWidth, aReflowState.reflowState.maxSize.height); + nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight); #endif // Reflow the child @@ -699,18 +699,18 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, if (gsDebug) printf("Row: RR -- row %p width = %d from maxSize %d\n", - this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); + this, aDesiredSize.width, aReflowState.reflowState.availableWidth); - if (aDesiredSize.width > aReflowState.reflowState.maxSize.width) + if (aDesiredSize.width > aReflowState.reflowState.availableWidth) { if (gsDebug) { printf ("Row %p error case, desired width = %d, maxSize=%d\n", - this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); + this, aDesiredSize.width, aReflowState.reflowState.availableWidth); fflush (stdout); } } - NS_ASSERTION(aDesiredSize.width <= aReflowState.reflowState.maxSize.width, "row calculated to be too wide."); + NS_ASSERTION(aDesiredSize.width <= aReflowState.reflowState.availableWidth, "row calculated to be too wide."); return rv; } @@ -1279,7 +1279,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // column width isn't dependent on the max cell width... kidReflowState.reason = eReflowReason_Resize; kidReflowState.reflowCommand = nsnull; - kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE; + kidReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); if (gsDebug) printf ("TR %p for cell %p Incremental Reflow: desired=%d, MES=%d\n", @@ -1296,7 +1296,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Now reflow the cell again this time constraining the width // XXX Ignore for now the possibility that the column width has changed... - kidReflowState.maxSize.width = availWidth; + kidReflowState.availableWidth = availWidth; rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); // Place the child after taking into account it's margin and attributes @@ -1348,7 +1348,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, printf("incr -- row %p width = %d MES=%d from maxSize %d\n", this, aDesiredSize.width, aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : -1, - aReflowState.reflowState.maxSize.width); + aReflowState.reflowState.availableWidth); } else { // pass reflow to unknown frame child @@ -1370,7 +1370,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, nsresult rv=NS_OK; if (gsDebug==PR_TRUE) printf("nsTableRowFrame::Reflow - aMaxSize = %d, %d\n", - aReflowState.maxSize.width, aReflowState.maxSize.height); + aReflowState.availableWidth, aReflowState.availableHeight); // Initialize 'out' parameters (aStatus set below, undefined if rv returns an error) if (nsnull != aDesiredSize.maxElementSize) { @@ -1395,9 +1395,10 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, if (PR_FALSE==tableFrame->RequiresPass1Layout()) { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. + nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowState resizeReflowState(aPresContext, (nsIFrame *)this, (const nsHTMLReflowState&)(*(aReflowState.parentReflowState)), - (const nsSize&)(aReflowState.maxSize), + availSpace, eReflowReason_Resize); RowReflowState rowResizeReflowState(resizeReflowState, tableFrame); rv = ResizeReflow(aPresContext, aDesiredSize, rowResizeReflowState, aStatus); diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 12d839294ab..7923b004a12 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -70,11 +70,11 @@ struct RowGroupReflowState { : mPresContext(aPresContext), reflowState(aReflowState) { - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; y=0; // border/padding??? - unconstrainedWidth = PRBool(reflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - unconstrainedHeight = PRBool(reflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); + unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE); firstRow = PR_TRUE; firstRowHeight=0; tableFrame = aTableFrame; @@ -866,12 +866,12 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, kidFrame->GetRect(bounds); // XXX This check isn't correct if there's a footer... - if (bounds.YMost() > aReflowState.maxSize.height) { + if (bounds.YMost() > aReflowState.availableHeight) { // If this is the first row frame then we need to split it if (nsnull == prevKidFrame) { // Reflow the row in the available space and have it split - nsSize kidAvailSize(aReflowState.maxSize.width, - aReflowState.maxSize.height - bounds.y); + nsSize kidAvailSize(aReflowState.availableWidth, + aReflowState.availableHeight - bounds.y); nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, kidAvailSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); @@ -932,7 +932,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, nsresult rv=NS_OK; if (gsDebug==PR_TRUE) printf("nsTableRowGroupFrame::Reflow - aMaxSize = %d, %d\n", - aReflowState.maxSize.width, aReflowState.maxSize.height); + aReflowState.availableWidth, aReflowState.availableHeight); // Initialize out parameter if (nsnull != aDesiredSize.maxElementSize) { @@ -975,7 +975,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, #endif // Return our desired rect - aDesiredSize.width = aReflowState.maxSize.width; + aDesiredSize.width = aReflowState.availableWidth; aDesiredSize.height = state.y; // shrink wrap rows to height of tallest cell in that row @@ -984,7 +984,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, } // See if all the frames fit - if (aDesiredSize.height > aReflowState.maxSize.height) { + if (aDesiredSize.height > aReflowState.availableHeight) { // Nope, find a place to split the row group SplitRowGroup(aPresContext, aDesiredSize, aReflowState, aStatus); } @@ -1289,7 +1289,8 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte // Pass along the reflow command // XXX Correctly compute the available space... - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, aReflowState.reflowState.maxSize); + nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); + nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, availSpace); nsHTMLReflowMetrics desiredSize(nsnull); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -1304,7 +1305,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte oldKidRect.height); // Return of desired size - aDesiredSize.width = aReflowState.reflowState.maxSize.width; + aDesiredSize.width = aReflowState.reflowState.availableWidth; aDesiredSize.height = aReflowState.y; return rv; diff --git a/mozilla/layout/html/tests/TestInlineFrame.cpp b/mozilla/layout/html/tests/TestInlineFrame.cpp index c5057f25bce..5a7bbef4e93 100644 --- a/mozilla/layout/html/tests/TestInlineFrame.cpp +++ b/mozilla/layout/html/tests/TestInlineFrame.cpp @@ -113,7 +113,7 @@ NS_METHOD FixedSizeFrame::Reflow(nsIPresContext& aPresContext, const nsReflowState& aReflowState, nsReflowStatus& aStatus) { - NS_PRECONDITION((aReflowState.maxSize.width > 0) && (aReflowState.maxSize.height > 0), + NS_PRECONDITION((aReflowState.availableWidth > 0) && (aReflowState.availableHeight > 0), "bad max size"); FixedSizeContent* content = (FixedSizeContent*)mContent; nsReflowStatus status = NS_FRAME_COMPLETE; diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 083a8532d42..a30e255f889 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -344,12 +344,12 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, aStatus = NS_FRAME_COMPLETE; if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT) printf("%p nsTableCellFrame::Reflow: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); - nsSize availSize(aReflowState.maxSize); + nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); nsSize maxElementSize; nsSize *pMaxElementSize = aDesiredSize.maxElementSize; - if (NS_UNCONSTRAINEDSIZE==aReflowState.maxSize.width) + if (NS_UNCONSTRAINEDSIZE==aReflowState.availableWidth) pMaxElementSize = &maxElementSize; nscoord x = 0; // SEC: what about ascent and decent??? @@ -417,7 +417,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, availSize.width, availSize.height); nsHTMLReflowMetrics kidSize(pMaxElementSize); kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; - SetPriorAvailWidth(aReflowState.maxSize.width); + SetPriorAvailWidth(aReflowState.availableWidth); nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState, availSize); @@ -456,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, if (gsDebug) printf ("setting initial child width from 0 to %d for nav4 compatibility\n", NSIntPixelsToTwips(4, p2t)); } else // empty content has to be forced to the assigned width for resize or incremental reflow - kidSize.width = kidReflowState.maxSize.width; + kidSize.width = kidReflowState.availableWidth; } if (0==kidSize.height) { diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 2145f65fe95..f7f394cd2f7 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -483,7 +483,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresC nsHTMLReflowMetrics desiredSize(nsnull); nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState, - aReflowState.maxSize); + nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 7d3b3914568..56e1a888d5c 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -107,14 +107,14 @@ struct InnerTableReflowState { { y=0; // border/padding??? - unconstrainedWidth = PRBool(aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - availSize.width = aReflowState.maxSize.width; + unconstrainedWidth = PRBool(aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + availSize.width = aReflowState.availableWidth; if (!unconstrainedWidth) { availSize.width -= aBorderPadding.left + aBorderPadding.right; } - unconstrainedHeight = PRBool(aReflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); - availSize.height = aReflowState.maxSize.height; + unconstrainedHeight = PRBool(aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE); + availSize.height = aReflowState.availableHeight; if (!unconstrainedHeight) { availSize.height -= aBorderPadding.top + aBorderPadding.bottom; } @@ -2331,7 +2331,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, { printf("-----------------------------------------------------------------\n"); printf("nsTableFrame::Reflow: table %p reason %d given maxSize=%d,%d\n", - this, aReflowState.reason, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight); } // Initialize out parameter @@ -2348,7 +2348,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, } // NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow - if (PR_TRUE==NeedsReflow(aReflowState, aReflowState.maxSize)) + if (PR_TRUE==NeedsReflow(aReflowState, nsSize(aReflowState.availableWidth, aReflowState.availableHeight))) { PRBool needsRecalc=PR_FALSE; if (PR_TRUE==gsDebug || PR_TRUE==gsDebugIR) printf("TIF Reflow: needs reflow\n"); @@ -2411,7 +2411,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, if (nsnull==mPrevInFlow) { // only do this for a first-in-flow table frame // assign column widths, and assign aMaxElementSize->width - BalanceColumnWidths(aPresContext, aReflowState, aReflowState.maxSize, + BalanceColumnWidths(aPresContext, aReflowState, nsSize(aReflowState.availableWidth, aReflowState.availableHeight), aDesiredSize.maxElementSize); // assign table width @@ -2420,7 +2420,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, // Constrain our reflow width to the computed table width nsHTMLReflowState reflowState(aReflowState); - reflowState.maxSize.width = mRect.width; + reflowState.availableWidth = mRect.width; rv = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, aStatus); if (NS_FAILED(rv)) return rv; @@ -2468,7 +2468,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, NS_ASSERTION(nsnull != mContent, "null content"); if (PR_TRUE==gsDebugNT) printf("%p nsTableFrame::ResizeReflow Pass1: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); nsresult rv=NS_OK; // set out params aStatus = NS_FRAME_COMPLETE; @@ -2576,7 +2576,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass2(nsIPresContext& aPresContext, "bad parent reflow state"); if (PR_TRUE==gsDebugNT) printf("%p nsTableFrame::ResizeReflow Pass2: maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); nsresult rv = NS_OK; // set out param @@ -3075,9 +3075,10 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Pass along the reflow command nsHTMLReflowMetrics desiredSize(nsnull); // XXX Correctly compute the available space... + nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, - aReflowState.reflowState.maxSize); + availSpace); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -3104,7 +3105,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, nscoord nsTableFrame::ComputeDesiredWidth(const nsHTMLReflowState& aReflowState) const { - nscoord desiredWidth=aReflowState.maxSize.width; + nscoord desiredWidth=aReflowState.availableWidth; // this is the biggest hack in the world. But there's no other rational way to handle nested percent tables const nsStylePosition* position; PRBool isNested=IsNested(aReflowState, position); @@ -4612,7 +4613,7 @@ PRBool nsTableFrame::IsNested(const nsHTMLReflowState& aReflowState, const nsSty nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowState) { const nsStyleDisplay *display; - nscoord parentWidth = aReflowState.maxSize.width; + nscoord parentWidth = aReflowState.availableWidth; // Walk up the reflow state chain until we find a block // frame. Our width is computed relative to there. @@ -4643,9 +4644,9 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta // then we can use it if (PR_FALSE==skipThisBlock) { - if (NS_UNCONSTRAINEDSIZE!=rs->maxSize.width) + if (NS_UNCONSTRAINEDSIZE!=rs->availableWidth) { - parentWidth = rs->maxSize.width; + parentWidth = rs->availableWidth; if (PR_TRUE==gsDebugNT) printf("%p: found a block frame %p, returning width %d\n", aReflowState.frame, rs->frame, parentWidth); @@ -4778,7 +4779,7 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta else { // the table has not yet been sized, so we need to infer the available space - parentWidth = rs->maxSize.width; + parentWidth = rs->availableWidth; if (eStyleUnit_Percent == tablePosition->mWidth.GetUnit()) { float percent = tablePosition->mWidth.GetPercentValue(); diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index de81ab095ce..ec79de2db05 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -74,13 +74,13 @@ struct OuterTableReflowState { : reflowState(aReflowState) { pc = &aPresContext; - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; prevMaxPosBottomMargin = 0; prevMaxNegBottomMargin = 0; y=0; // border/padding/margin??? - unconstrainedWidth = PRBool(aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - unconstrainedHeight = PRBool(aReflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); + unconstrainedWidth = PRBool(aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + unconstrainedHeight = PRBool(aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE); innerTableMaxSize.width=0; innerTableMaxSize.height=0; } @@ -179,7 +179,7 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aReflowState, mInnerTableFrame->GetSize(innerTableSize); aReflowState.innerTableMaxSize.width = innerTableSize.width; - aReflowState.innerTableMaxSize.height = aReflowState.reflowState.maxSize.height; + aReflowState.innerTableMaxSize.height = aReflowState.reflowState.availableHeight; return NS_OK; } @@ -338,7 +338,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, nsSize(mRect.width, - aReflowState.reflowState.maxSize.height), + aReflowState.reflowState.availableHeight), aReflowState.reflowState.reason); captionReflowState.reflowCommand=aReflowState.reflowState.reflowCommand; rv = ReflowChild(mCaptionFrame, aPresContext, captionSize, captionReflowState, aStatus); @@ -379,7 +379,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(tableWidth, aReflowState.reflowState.maxSize.height), + nsSize(tableWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (NS_FAILED(rv)) @@ -518,11 +518,11 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont // pass along the reflow command to the inner table if (PR_TRUE==gsDebugIR) printf("TOF IR: passing down incremental reflow command to inner table.\n"); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); - nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.maxSize.width, mMinCaptionWidth); + nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.availableWidth, mMinCaptionWidth); if (PR_TRUE==gsDebugIR) printf("TOF IR: mincaptionWidth=%d, tableMaxWidth=%d.\n", mMinCaptionWidth, tableMaxWidth); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(tableMaxWidth, aReflowState.reflowState.maxSize.height)); + nsSize(tableMaxWidth, aReflowState.reflowState.availableHeight)); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width=%d height=%d\n", rv, innerSize.width, innerSize.height); @@ -542,7 +542,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, nsSize(innerSize.width, - aReflowState.reflowState.maxSize.height), + aReflowState.reflowState.availableHeight), eReflowReason_Resize); nsIHTMLReflow* htmlReflow; if (NS_OK == mCaptionFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) @@ -662,7 +662,7 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte nsHTMLReflowMetrics captionSize(&maxElementSize); nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, aReflowState.reflowState, - nsSize(mRect.width, aReflowState.reflowState.maxSize.height), + nsSize(mRect.width, aReflowState.reflowState.availableHeight), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -692,7 +692,7 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if (PR_TRUE==gsDebugIR) printf("TOF IR: resize-reflowing inner table\n"); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(mMinCaptionWidth, aReflowState.reflowState.maxSize.height), + nsSize(mMinCaptionWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width =%d, height = %d\n", @@ -746,8 +746,8 @@ nsresult nsTableOuterFrame::IR_CaptionRemoved(nsIPresContext& aPresContex if (PR_TRUE==gsDebugIR) printf("TOF IR: reflowing inner table\n"); nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState.reflowState, - nsSize(aReflowState.reflowState.maxSize.width, - aReflowState.reflowState.maxSize.height)); + nsSize(aReflowState.reflowState.availableWidth, + aReflowState.reflowState.availableHeight)); // ReflowChild sets MES rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (NS_FAILED(rv)) @@ -845,8 +845,8 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) // Figure out the overall table width constraint. Default case, get 100% of // available space - if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) { - maxWidth = aReflowState.maxSize.width; + if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) { + maxWidth = aReflowState.availableWidth; } else { const nsStylePosition* position = @@ -857,19 +857,19 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) maxWidth = position->mWidth.GetCoordValue(); // NAV4 compatibility: 0-coord-width == auto-width if (0==maxWidth) - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Auto: - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Percent: - maxWidth = (nscoord)((float)aReflowState.maxSize.width * + maxWidth = (nscoord)((float)aReflowState.availableWidth * position->mWidth.GetPercentValue()); // NAV4 compatibility: 0-percent-width == auto-width if (0==maxWidth) - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; case eStyleUnit_Proportional: @@ -877,7 +877,7 @@ nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState) // XXX for now these fall through default: - maxWidth = aReflowState.maxSize.width; + maxWidth = aReflowState.availableWidth; break; } @@ -920,7 +920,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, nsresult rv = NS_OK; if (PR_TRUE==gsDebug) printf("%p: nsTableOuterFrame::Reflow : maxSize=%d,%d\n", - this, aReflowState.maxSize.width, aReflowState.maxSize.height); + this, aReflowState.availableWidth, aReflowState.availableHeight); PRIntervalTime startTime; if (gsTiming) { @@ -984,7 +984,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, // First reflow the inner table nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, aReflowState, - nsSize(tableWidth, aReflowState.maxSize.height)); + nsSize(tableWidth, aReflowState.availableHeight)); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index a4b2dfbfe7d..f5f0d64af8f 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -68,8 +68,8 @@ struct RowReflowState { nsTableFrame* aTableFrame) : reflowState(aReflowState) { - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; maxCellHeight = 0; maxCellVertSpace = 0; tableFrame = aTableFrame; @@ -572,7 +572,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, // cell frame has a next-in-flow nsIFrame* kidNextInFlow; kidFrame->GetNextInFlow(kidNextInFlow); - if ((aReflowState.reflowState.maxSize.height != NS_UNCONSTRAINEDSIZE) || + if ((aReflowState.reflowState.availableHeight != NS_UNCONSTRAINEDSIZE) || (availWidth != ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth()) || (nsnull != kidNextInFlow)) { @@ -584,7 +584,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsSize kidAvailSize(availWidth, NS_UNCONSTRAINEDSIZE); #else // Reflow the cell to fit the available height - nsSize kidAvailSize(availWidth, aReflowState.reflowState.maxSize.height); + nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight); #endif // Reflow the child @@ -699,18 +699,18 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, if (gsDebug) printf("Row: RR -- row %p width = %d from maxSize %d\n", - this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); + this, aDesiredSize.width, aReflowState.reflowState.availableWidth); - if (aDesiredSize.width > aReflowState.reflowState.maxSize.width) + if (aDesiredSize.width > aReflowState.reflowState.availableWidth) { if (gsDebug) { printf ("Row %p error case, desired width = %d, maxSize=%d\n", - this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); + this, aDesiredSize.width, aReflowState.reflowState.availableWidth); fflush (stdout); } } - NS_ASSERTION(aDesiredSize.width <= aReflowState.reflowState.maxSize.width, "row calculated to be too wide."); + NS_ASSERTION(aDesiredSize.width <= aReflowState.reflowState.availableWidth, "row calculated to be too wide."); return rv; } @@ -1279,7 +1279,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // column width isn't dependent on the max cell width... kidReflowState.reason = eReflowReason_Resize; kidReflowState.reflowCommand = nsnull; - kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE; + kidReflowState.availableWidth = NS_UNCONSTRAINEDSIZE; rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); if (gsDebug) printf ("TR %p for cell %p Incremental Reflow: desired=%d, MES=%d\n", @@ -1296,7 +1296,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Now reflow the cell again this time constraining the width // XXX Ignore for now the possibility that the column width has changed... - kidReflowState.maxSize.width = availWidth; + kidReflowState.availableWidth = availWidth; rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); // Place the child after taking into account it's margin and attributes @@ -1348,7 +1348,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, printf("incr -- row %p width = %d MES=%d from maxSize %d\n", this, aDesiredSize.width, aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : -1, - aReflowState.reflowState.maxSize.width); + aReflowState.reflowState.availableWidth); } else { // pass reflow to unknown frame child @@ -1370,7 +1370,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, nsresult rv=NS_OK; if (gsDebug==PR_TRUE) printf("nsTableRowFrame::Reflow - aMaxSize = %d, %d\n", - aReflowState.maxSize.width, aReflowState.maxSize.height); + aReflowState.availableWidth, aReflowState.availableHeight); // Initialize 'out' parameters (aStatus set below, undefined if rv returns an error) if (nsnull != aDesiredSize.maxElementSize) { @@ -1395,9 +1395,10 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, if (PR_FALSE==tableFrame->RequiresPass1Layout()) { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. + nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); nsHTMLReflowState resizeReflowState(aPresContext, (nsIFrame *)this, (const nsHTMLReflowState&)(*(aReflowState.parentReflowState)), - (const nsSize&)(aReflowState.maxSize), + availSpace, eReflowReason_Resize); RowReflowState rowResizeReflowState(resizeReflowState, tableFrame); rv = ResizeReflow(aPresContext, aDesiredSize, rowResizeReflowState, aStatus); diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 12d839294ab..7923b004a12 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -70,11 +70,11 @@ struct RowGroupReflowState { : mPresContext(aPresContext), reflowState(aReflowState) { - availSize.width = reflowState.maxSize.width; - availSize.height = reflowState.maxSize.height; + availSize.width = reflowState.availableWidth; + availSize.height = reflowState.availableHeight; y=0; // border/padding??? - unconstrainedWidth = PRBool(reflowState.maxSize.width == NS_UNCONSTRAINEDSIZE); - unconstrainedHeight = PRBool(reflowState.maxSize.height == NS_UNCONSTRAINEDSIZE); + unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE); + unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE); firstRow = PR_TRUE; firstRowHeight=0; tableFrame = aTableFrame; @@ -866,12 +866,12 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, kidFrame->GetRect(bounds); // XXX This check isn't correct if there's a footer... - if (bounds.YMost() > aReflowState.maxSize.height) { + if (bounds.YMost() > aReflowState.availableHeight) { // If this is the first row frame then we need to split it if (nsnull == prevKidFrame) { // Reflow the row in the available space and have it split - nsSize kidAvailSize(aReflowState.maxSize.width, - aReflowState.maxSize.height - bounds.y); + nsSize kidAvailSize(aReflowState.availableWidth, + aReflowState.availableHeight - bounds.y); nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, kidAvailSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); @@ -932,7 +932,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, nsresult rv=NS_OK; if (gsDebug==PR_TRUE) printf("nsTableRowGroupFrame::Reflow - aMaxSize = %d, %d\n", - aReflowState.maxSize.width, aReflowState.maxSize.height); + aReflowState.availableWidth, aReflowState.availableHeight); // Initialize out parameter if (nsnull != aDesiredSize.maxElementSize) { @@ -975,7 +975,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, #endif // Return our desired rect - aDesiredSize.width = aReflowState.maxSize.width; + aDesiredSize.width = aReflowState.availableWidth; aDesiredSize.height = state.y; // shrink wrap rows to height of tallest cell in that row @@ -984,7 +984,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, } // See if all the frames fit - if (aDesiredSize.height > aReflowState.maxSize.height) { + if (aDesiredSize.height > aReflowState.availableHeight) { // Nope, find a place to split the row group SplitRowGroup(aPresContext, aDesiredSize, aReflowState, aStatus); } @@ -1289,7 +1289,8 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte // Pass along the reflow command // XXX Correctly compute the available space... - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, aReflowState.reflowState.maxSize); + nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); + nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, availSpace); nsHTMLReflowMetrics desiredSize(nsnull); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -1304,7 +1305,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte oldKidRect.height); // Return of desired size - aDesiredSize.width = aReflowState.reflowState.maxSize.width; + aDesiredSize.width = aReflowState.reflowState.availableWidth; aDesiredSize.height = aReflowState.y; return rv;