Fix miscellaneous reflow methods to use new overflow area APIs. (Bug 542595, patch 19) r=roc a2.0=blocking2.0:beta8

This commit is contained in:
L. David Baron 2010-10-06 21:25:46 -07:00
parent 08c54cb878
commit 40d60928c6
33 changed files with 111 additions and 124 deletions

View File

@ -7746,10 +7746,14 @@ PresShell::DoReflow(nsIFrame* target, PRBool aInterruptible)
desiredSize.height == size.height),
"non-root frame's desired size changed during an "
"incremental reflow");
NS_ASSERTION(desiredSize.mOverflowArea ==
NS_ASSERTION(desiredSize.VisualOverflow() ==
nsRect(nsPoint(0, 0),
nsSize(desiredSize.width, desiredSize.height)),
"reflow roots must not have visible overflow");
NS_ASSERTION(desiredSize.ScrollableOverflow() ==
nsRect(nsPoint(0, 0),
nsSize(desiredSize.width, desiredSize.height)),
"reflow roots must not have scrollable overflow");
NS_ASSERTION(status == NS_FRAME_COMPLETE,
"reflow roots should never split");
@ -7757,7 +7761,7 @@ PresShell::DoReflow(nsIFrame* target, PRBool aInterruptible)
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, target,
target->GetView(),
&desiredSize.mOverflowArea);
desiredSize.VisualOverflow());
nsContainerFrame::SyncWindowProperties(mPresContext, target,
target->GetView());

View File

@ -597,14 +597,14 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.height = min;
}
aDesiredSize.width = contentRect.width + borderPadding.LeftRight();
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (mLegendFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mLegendFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mLegendFrame);
if (mContentFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mContentFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mContentFrame);
FinishAndStoreOverflow(&aDesiredSize);
Invalidate(aDesiredSize.mOverflowArea);
Invalidate(aDesiredSize.VisualOverflow());
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;

View File

@ -281,9 +281,8 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.ascent +=
aReflowState.mComputedBorderPadding.top + focusPadding.top;
aDesiredSize.mOverflowArea =
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
ConsiderChildOverflow(aDesiredSize.mOverflowArea, firstKid);
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, firstKid);
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;

View File

@ -181,8 +181,8 @@ BRFrame::Reflow(nsPresContext* aPresContext,
else {
aStatus = NS_FRAME_COMPLETE;
}
aMetrics.mOverflowArea = nsRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
return NS_OK;

View File

@ -1407,8 +1407,8 @@ nsBulletFrame::Reflow(nsPresContext* aPresContext,
// overflow their font-boxes. It'll do for now; to fix it for real, we really
// should rewrite all the text-handling code here to use gfxTextRun (bug
// 397294).
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
return NS_OK;

View File

@ -548,9 +548,9 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.height = aReflowState.ComputedHeight();
}
aDesiredSize.mOverflowArea.UnionRect(
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height),
kidDesiredSize.mOverflowArea + kidPt);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aDesiredSize.mOverflowAreas.UnionWith(
kidDesiredSize.mOverflowAreas + kidPt);
if (mAbsoluteContainer.HasAbsoluteFrames()) {
PRBool widthChanged = aDesiredSize.width != mRect.width;

View File

@ -555,8 +555,8 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
nsRect contentRect(0, 0, 0, 0);
nsRect overflowRect(0, 0, 0, 0);
nsOverflowAreas overflowRects;
nsIFrame* child = mFrames.FirstChild();
nsPoint childOrigin = nsPoint(borderPadding.left, borderPadding.top);
// For RTL, figure out where the last column's left edge should be. Since the
@ -695,7 +695,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
contentRect.UnionRect(contentRect, child->GetRect());
ConsiderChildOverflow(overflowRect, child);
ConsiderChildOverflow(overflowRects, child);
contentBottom = NS_MAX(contentBottom, childContentBottom);
aColData.mLastHeight = childContentBottom;
aColData.mSumHeight += childContentBottom;
@ -801,7 +801,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
// If we're doing RTL, we need to make sure our last column is at the left-hand side of the frame.
if (RTL && childOrigin.x != targetX) {
overflowRect = nsRect(0, 0, 0, 0);
overflowRects.Clear();
contentRect = nsRect(0, 0, 0, 0);
PRInt32 deltaX = targetX - childOrigin.x;
#ifdef DEBUG_roc
@ -809,7 +809,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
#endif
for (child = mFrames.FirstChild(); child; child = child->GetNextSibling()) {
MoveChildTo(this, child, child->GetPosition() + nsPoint(deltaX, 0));
ConsiderChildOverflow(overflowRect, child);
ConsiderChildOverflow(overflowRects, child);
contentRect.UnionRect(contentRect, child->GetRect());
}
}
@ -847,9 +847,9 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
aDesiredSize.height = borderPadding.top + contentSize.height +
borderPadding.bottom;
aDesiredSize.width = contentSize.width + borderPadding.left + borderPadding.right;
overflowRect.UnionRect(overflowRect, nsRect(0, 0, aDesiredSize.width, aDesiredSize.height));
aDesiredSize.mOverflowArea = overflowRect;
aDesiredSize.mOverflowAreas = overflowRects;
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
#ifdef DEBUG_roc
printf("*** DONE PASS feasible=%d\n", allFit && NS_FRAME_IS_FULLY_COMPLETE(aStatus)
&& !NS_FRAME_IS_TRUNCATED(aStatus));

View File

@ -830,8 +830,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
// Make sure the frame's view is properly sized and positioned and has
// things like opacity correct
SyncFrameViewAfterReflow(aPresContext, aKidFrame, view,
&aDesiredSize.mOverflowArea,
aFlags);
aDesiredSize.VisualOverflow(), aFlags);
}
if (!(aFlags & NS_FRAME_NO_MOVE_VIEW) &&
@ -847,7 +846,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
// will be at the wrong offset ... note that this includes
// invalidates issued against the frame's children, so we need to
// invalidate the overflow area too.
aKidFrame->Invalidate(aDesiredSize.mOverflowArea);
aKidFrame->Invalidate(aDesiredSize.VisualOverflow());
}
return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED);
@ -948,7 +947,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
dirtyRect.MoveBy(oldRect.x, oldRect.y);
Invalidate(dirtyRect);
dirtyRect = frame->GetOverflowRect();
dirtyRect = frame->GetVisualOverflowRect();
dirtyRect.MoveBy(rect.x, rect.y);
Invalidate(dirtyRect);
}

View File

@ -249,9 +249,8 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
// Ensure that the overflow rect contains the child textframe's overflow rect.
// Note that if this is floating, the overline/underline drawable area is in
// the overflow rect of the child textframe.
aMetrics.mOverflowArea.UnionRect(aMetrics.mOverflowArea,
nsRect(0, 0, aMetrics.width, aMetrics.height));
ConsiderChildOverflow(aMetrics.mOverflowArea, kid);
aMetrics.UnionOverflowAreasWithDesiredBounds();
ConsiderChildOverflow(aMetrics.mOverflowAreas, kid);
// Create a continuation or remove existing continuations based on
// the reflow completion status.

View File

@ -4527,10 +4527,7 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
aMetrics.height = 0;
aMetrics.ascent = 0;
aMetrics.mCarriedOutBottomMargin.Zero();
aMetrics.mOverflowArea.x = 0;
aMetrics.mOverflowArea.y = 0;
aMetrics.mOverflowArea.width = 0;
aMetrics.mOverflowArea.height = 0;
aMetrics.mOverflowAreas.Clear();
return PR_TRUE;
}
mState &= ~NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
@ -6825,8 +6822,9 @@ nsFrame::DoLayout(nsBoxLayoutState& aState)
// Should we do this if IsCollapsed() is true?
nsSize size(GetSize());
desiredSize.mOverflowArea.UnionRect(desiredSize.mOverflowArea,
nsRect(nsPoint(0, 0), size));
desiredSize.width = size.width;
desiredSize.height = size.height;
desiredSize.UnionOverflowAreasWithDesiredBounds();
FinishAndStoreOverflow(desiredSize.mOverflowAreas, size);
SyncLayout(aState);

View File

@ -1232,8 +1232,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
mDrag.UnSet();
aDesiredSize.mOverflowArea = nsRect(0, 0,
aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
@ -1609,8 +1608,7 @@ nsHTMLFramesetBorderFrame::Reflow(nsPresContext* aPresContext,
// computed values are.
SizeToAvailSize(aReflowState, aDesiredSize);
aDesiredSize.mOverflowArea = nsRect(0, 0,
aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
@ -1816,8 +1814,7 @@ nsHTMLFramesetBlankFrame::Reflow(nsPresContext* aPresContext,
// computed values are.
SizeToAvailSize(aReflowState, aDesiredSize);
aDesiredSize.mOverflowArea = nsRect(0, 0,
aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}

View File

@ -531,8 +531,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
// right now, just fix up the overflow area if necessary. Note that we don't
// check HasOverflowRect() because it could be set even though the
// overflow area doesn't include the frame bounds.
aMetrics->mOverflowArea.UnionRect(aMetrics->mOverflowArea,
nsRect(0, 0, aMetrics->width, aMetrics->height));
aMetrics->UnionOverflowAreasWithDesiredBounds();
aState->mContentsOverflowArea = aMetrics->mOverflowArea;
aState->mReflowedContentsWithHScrollbar = aAssumeHScroll;
@ -710,7 +709,7 @@ nsHTMLScrollFrame::PlaceScrollArea(const ScrollReflowState& aState,
nsContainerFrame::SyncFrameViewAfterReflow(scrolledFrame->PresContext(),
scrolledFrame,
scrolledFrame->GetView(),
&scrolledArea,
scrolledArea,
0);
}
@ -858,7 +857,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.height = state.mInsideBorderSize.height +
state.mComputedBorder.TopBottom();
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
CheckInvalidateSizeChange(aDesiredSize);

View File

@ -209,7 +209,7 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
aMetrics.height = NS_MAX(0, aMetrics.height);
}
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
if (mRect.width != aMetrics.width || mRect.height != aMetrics.height) {

View File

@ -857,7 +857,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_NOT_COMPLETE;
}
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
// Now that that's all done, check whether we're resizing... if we are,

View File

@ -679,7 +679,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
// For now our overflow area is zero. The real value will be
// computed in |nsLineLayout::RelativePositionFrames|.
aMetrics.mOverflowArea.SetRect(0, 0, 0, 0);
aMetrics.mOverflowAreas.Clear();
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);

View File

@ -120,9 +120,8 @@ nsLeafFrame::DoReflow(nsPresContext* aPresContext,
aMetrics.width, aMetrics.height));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
aMetrics.mOverflowArea =
nsRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
return NS_OK;
}
@ -149,7 +148,6 @@ nsLeafFrame::SizeToAvailSize(const nsHTMLReflowState& aReflowState,
{
aDesiredSize.width = aReflowState.availableWidth; // FRAME
aDesiredSize.height = aReflowState.availableHeight;
aDesiredSize.mOverflowArea =
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
}

View File

@ -939,7 +939,7 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
// Get our desired size
GetDesiredSize(aPresContext, aReflowState, aMetrics);
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
// delay plugin instantiation until all children have

View File

@ -165,8 +165,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Return our desired size
aDesiredSize.height = mSize.height * PresContext()->GetPrintPreviewScale();
aDesiredSize.width = mSize.width * PresContext()->GetPrintPreviewScale();
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width,
aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
return NS_OK;
}
@ -350,8 +349,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.height = y * PresContext()->GetPrintPreviewScale(); // includes page heights and dead space
aDesiredSize.width = w * PresContext()->GetPrintPreviewScale();
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width,
aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
// cache the size so we can set the desired size

View File

@ -6696,7 +6696,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
}
}
Invalidate(aMetrics.mOverflowArea);
Invalidate(aMetrics.VisualOverflow());
#ifdef NOISY_REFLOW
ListTag(stdout);

View File

@ -335,7 +335,7 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
aReflowState.ComputedHeight()));
}
}
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);

View File

@ -336,8 +336,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
}
// XXX Should we do something to clip our children to this?
aDesiredSize.mOverflowArea =
nsRect(nsPoint(0, 0), nsSize(aDesiredSize.width, aDesiredSize.height));
aDesiredSize.SetOverflowAreasToDesiredBounds();
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);

View File

@ -856,12 +856,15 @@ nsMathMLContainerFrame::GatherAndStoreOverflow(nsHTMLReflowMetrics* aMetrics)
{
// nsIFrame::FinishAndStoreOverflow likes the overflow area to include the
// frame rectangle.
nsRect frameRect(0, 0, aMetrics->width, aMetrics->height);
aMetrics->SetOverflowAreasToDesiredBounds();
// Text-shadow overflows.
if (PresContext()->CompatibilityMode() != eCompatibility_NavQuirks) {
nsRect frameRect(0, 0, aMetrics->width, aMetrics->height);
nsRect shadowRect = nsLayoutUtils::GetTextShadowRectsUnion(frameRect, this);
frameRect.UnionRect(frameRect, shadowRect);
// shadows contribute only to visual overflow
nsRect& visOverflow = aMetrics->VisualOverflow();
visOverflow.UnionRect(visOverflow, shadowRect);
}
// All non-child-frame content such as nsMathMLChars (and most child-frame
@ -871,7 +874,9 @@ nsMathMLContainerFrame::GatherAndStoreOverflow(nsHTMLReflowMetrics* aMetrics)
mBoundingMetrics.rightBearing - mBoundingMetrics.leftBearing,
mBoundingMetrics.ascent + mBoundingMetrics.descent);
aMetrics->mOverflowArea.UnionRect(frameRect, boundingBox);
// REVIEW: Maybe this should contribute only to visual overflow
// and not scrollable?
aMetrics->mOverflowAreas.UnionAllWith(boundingBox);
// mBoundingMetrics does not necessarily include content of <mpadded>
// elements whose mBoundingMetrics may not be representative of the true
@ -879,7 +884,7 @@ nsMathMLContainerFrame::GatherAndStoreOverflow(nsHTMLReflowMetrics* aMetrics)
// make such to include child overflow areas.
nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) {
ConsiderChildOverflow(aMetrics->mOverflowArea, childFrame);
ConsiderChildOverflow(aMetrics->mOverflowAreas, childFrame);
childFrame = childFrame->GetNextSibling();
}

View File

@ -154,8 +154,7 @@ nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.width = aReflowState.ComputedWidth();
aDesiredSize.height = aReflowState.ComputedHeight();
aDesiredSize.mOverflowArea =
nsRect(0, 0, aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
return NS_OK;

View File

@ -345,7 +345,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
// Make sure we scroll if we're too big:
// XXX Use the bounding box of our descendants? (See bug 353460 comment 14.)
aDesiredSize.mOverflowArea.SetRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
// If our SVG viewport has changed, update our content and notify.

View File

@ -618,7 +618,7 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
if (HasView()) {
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this,
GetView(),
&desiredSize.mOverflowArea, 0);
desiredSize.VisualOverflow(), 0);
}
}

View File

@ -1824,7 +1824,7 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
else {
// Calculate the overflow area contribution from our children.
for (nsIFrame* kid = GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
ConsiderChildOverflow(aDesiredSize.mOverflowArea, kid);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kid);
}
}
@ -1852,11 +1852,11 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
nsMargin bcMargin = GetExcludedOuterBCBorder();
tableRect.Inflate(bcMargin);
}
aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, tableRect);
aDesiredSize.mOverflowAreas.UnionAllWith(tableRect);
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
// Fulfill the promise InvalidateFrame makes.
Invalidate(aDesiredSize.mOverflowArea);
Invalidate(aDesiredSize.VisualOverflow());
} else {
CheckInvalidateSizeChange(aDesiredSize);
}
@ -2976,7 +2976,7 @@ nsTableFrame::CalcDesiredHeight(const nsHTMLReflowState& aReflowState, nsHTMLRef
DistributeHeightToRows(aReflowState, tableSpecifiedHeight - desiredHeight);
// this might have changed the overflow area incorporate the childframe overflow area.
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) {
ConsiderChildOverflow(aDesiredSize.mOverflowArea, kidFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
}
desiredHeight = tableSpecifiedHeight;
}
@ -2993,8 +2993,7 @@ void ResizeCells(nsTableFrame& aTableFrame)
nsRect tableRect = aTableFrame.GetRect();
tableDesiredSize.width = tableRect.width;
tableDesiredSize.height = tableRect.height;
tableDesiredSize.mOverflowArea = nsRect(0, 0, tableRect.width,
tableRect.height);
tableDesiredSize.SetOverflowAreasToDesiredBounds();
for (PRUint32 rgX = 0; rgX < rowGroups.Length(); rgX++) {
nsTableRowGroupFrame* rgFrame = rowGroups[rgX];
@ -3003,19 +3002,17 @@ void ResizeCells(nsTableFrame& aTableFrame)
nsHTMLReflowMetrics groupDesiredSize;
groupDesiredSize.width = rowGroupRect.width;
groupDesiredSize.height = rowGroupRect.height;
groupDesiredSize.mOverflowArea = nsRect(0, 0, groupDesiredSize.width,
groupDesiredSize.height);
groupDesiredSize.SetOverflowAreasToDesiredBounds();
nsTableRowFrame* rowFrame = rgFrame->GetFirstRow();
while (rowFrame) {
rowFrame->DidResize();
rgFrame->ConsiderChildOverflow(groupDesiredSize.mOverflowArea, rowFrame);
rgFrame->ConsiderChildOverflow(groupDesiredSize.mOverflowAreas, rowFrame);
rowFrame = rowFrame->GetNextRow();
}
rgFrame->FinishAndStoreOverflow(&groupDesiredSize);
// make the coordinates of |desiredSize.mOverflowArea| incorrect
// since it's about to go away:
groupDesiredSize.mOverflowArea.MoveBy(rgFrame->GetPosition());
tableDesiredSize.mOverflowArea.UnionRect(tableDesiredSize.mOverflowArea, groupDesiredSize.mOverflowArea);
tableDesiredSize.mOverflowAreas.UnionWith(groupDesiredSize.mOverflowAreas +
rgFrame->GetPosition());
}
aTableFrame.FinishAndStoreOverflow(&tableDesiredSize);
}

View File

@ -957,10 +957,10 @@ nsTableOuterFrame::UpdateReflowMetrics(PRUint8 aCaptionSide,
SetDesiredSize(aCaptionSide, aInnerMargin, aCaptionMargin,
aMet.width, aMet.height);
aMet.mOverflowArea = nsRect(0, 0, aMet.width, aMet.height);
ConsiderChildOverflow(aMet.mOverflowArea, mInnerTableFrame);
aMet.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aMet.mOverflowAreas, mInnerTableFrame);
if (mCaptionFrame) {
ConsiderChildOverflow(aMet.mOverflowArea, mCaptionFrame);
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrame);
}
FinishAndStoreOverflow(&aMet);
}

View File

@ -374,8 +374,7 @@ nsTableRowFrame::DidResize()
nsHTMLReflowMetrics desiredSize;
desiredSize.width = mRect.width;
desiredSize.height = mRect.height;
desiredSize.mOverflowArea = nsRect(0, 0, desiredSize.width,
desiredSize.height);
desiredSize.SetOverflowAreasToDesiredBounds();
while (childFrame) {
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
@ -399,7 +398,7 @@ nsTableRowFrame::DidResize()
// Always store the overflow, even if the height didn't change, since
// we'll lose part of our overflow area otherwise.
ConsiderChildOverflow(desiredSize.mOverflowArea, cellFrame);
ConsiderChildOverflow(desiredSize.mOverflowAreas, cellFrame);
// Note that if the cell's *content* needs to change in response
// to this height, it will get a special height reflow.
@ -409,7 +408,8 @@ nsTableRowFrame::DidResize()
}
FinishAndStoreOverflow(&desiredSize);
if (HasView()) {
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(), &desiredSize.mOverflowArea, 0);
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(),
desiredSize.VisualOverflow(), 0);
}
// Let our base class do the usual work
}
@ -927,12 +927,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
desiredSize.width = cellDesiredSize.width;
desiredSize.height = cellDesiredSize.height;
if (cellFrame->HasOverflowRect())
desiredSize.mOverflowArea = cellFrame->GetOverflowRect();
else
desiredSize.mOverflowArea.SetRect(0, 0, cellDesiredSize.width,
cellDesiredSize.height);
desiredSize.mOverflowAreas = cellFrame->GetOverflowAreas();
// if we are in a floated table, our position is not yet established, so we cannot reposition our views
// the containing block will do this for us after positioning the table
if (!aTableFrame.GetStyleDisplay()->IsFloating()) {
@ -993,7 +989,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
aStatus = NS_FRAME_NOT_COMPLETE;
}
}
ConsiderChildOverflow(aDesiredSize.mOverflowArea, kidFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
x += cellSpacingX;
}
@ -1030,8 +1026,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
}
aDesiredSize.height = NS_MAX(cellMaxHeight, styleHeight);
}
nsRect rowRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, rowRect);
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
return rv;
}

View File

@ -475,7 +475,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
aReflowState.availSize.height -= height;
}
}
ConsiderChildOverflow(aDesiredSize.mOverflowArea, kidFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
}
if (haveRow)
@ -548,11 +548,11 @@ nsTableRowGroupFrame::DidResizeRows(nsHTMLReflowMetrics& aDesiredSize)
// update the cells spanning rows with their new heights
// this is the place where all of the cells in the row get set to the height of the row
// Reset the overflow area
aDesiredSize.mOverflowArea = nsRect(0, 0, 0, 0);
aDesiredSize.mOverflowAreas.Clear();
for (nsTableRowFrame* rowFrame = GetFirstRow();
rowFrame; rowFrame = rowFrame->GetNextRow()) {
rowFrame->DidResize();
ConsiderChildOverflow(aDesiredSize.mOverflowArea, rowFrame);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, rowFrame);
}
}
@ -1349,8 +1349,7 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
// just set our width to what was available. The table will calculate the width and not use our value.
aDesiredSize.width = aReflowState.availableWidth;
aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, nsRect(0, 0, aDesiredSize.width,
aDesiredSize.height));
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.

View File

@ -610,28 +610,29 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
flags |= stateFlags;
nsRect rect(nsPoint(0, 0), GetSize());
nsRect visualOverflow;
if (ComputesOwnOverflowArea()) {
rect = GetOverflowRect();
visualOverflow = GetVisualOverflowRect();
}
else {
nsRect rect(nsPoint(0, 0), GetSize());
nsOverflowAreas overflowAreas(rect, rect);
if (!DoesClipChildren() && !IsCollapsed(aState)) {
// See if our child frames caused us to overflow after being laid
// out. If so, store the overflow area. This normally can't happen
// in XUL, but it can happen with the CSS 'outline' property and
// possibly with other exotic stuff (e.g. relatively positioned
// frames in HTML inside XUL).
nsIFrame* box = GetChildBox();
while (box) {
nsRect bounds = box->GetOverflowRect() + box->GetPosition();
rect.UnionRect(rect, bounds);
box = box->GetNextBox();
for (nsIFrame* kid = GetChildBox(); kid; kid = kid->GetNextBox()) {
nsOverflowAreas kidOverflow =
kid->GetOverflowAreas() + kid->GetPosition();
overflowAreas.UnionWith(kidOverflow);
}
}
FinishAndStoreOverflow(&rect, GetSize());
FinishAndStoreOverflow(overflowAreas, GetSize());
visualOverflow = overflowAreas.VisualOverflow();
}
nsIView* view = GetView();
@ -642,7 +643,7 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
presContext,
this,
view,
&rect,
visualOverflow,
flags);
}

View File

@ -759,7 +759,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.height = mRect.height;
aDesiredSize.ascent = ascent;
aDesiredSize.mOverflowArea = GetOverflowRect();
aDesiredSize.mOverflowAreas = GetOverflowAreas();
#ifdef DO_NOISY_REFLOW
{

View File

@ -340,7 +340,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.ascent = GetBoxAscent(state);
// the overflow rect is set in SetBounds() above
aDesiredSize.mOverflowArea = GetOverflowRect();
aDesiredSize.mOverflowAreas = GetOverflowAreas();
#ifdef DO_NOISY_REFLOW
{

View File

@ -292,21 +292,22 @@ nsListBoxBodyFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
// determine the real height for the scrollable area from the total number
// of rows, since non-visible rows don't yet have frames
nsSize size = GetSize();
nsRect overflowRect = nsRect(nsPoint(0, 0), size);
nsRect rect(nsPoint(0, 0), GetSize());
nsOverflowAreas overflow(rect, rect);
if (mLayoutManager) {
nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) {
ConsiderChildOverflow(overflowRect, childFrame);
ConsiderChildOverflow(overflow, childFrame);
childFrame = childFrame->GetNextSibling();
}
nsSize prefSize = mLayoutManager->GetPrefSize(this, aBoxLayoutState);
if (prefSize.height > overflowRect.height) {
overflowRect.height = prefSize.height;
NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
nsRect& o = overflow.Overflow(otype);
o.height = NS_MAX(o.height, prefSize.height);
}
}
FinishAndStoreOverflow(&overflowRect, GetSize());
FinishAndStoreOverflow(overflow, GetSize());
if (mScrolling)
aBoxLayoutState.SetPaintingDisabled(PR_FALSE);