# HG changeset patch # User Benjamin Stover # Date 1308589389 25200 # Node ID cf1b903389ced356e4b56ccd984ebddad4273fd8 # Parent c40a265eb1700d041331b9265ebef8bd3e0aceb7 Bug 665597 Include margin calculations in FinishAndStoreOverflow diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1137,9 +1137,8 @@ } // Compute our final size - nscoord bottomEdgeOfChildren; - ComputeFinalSize(*reflowState, state, aMetrics, &bottomEdgeOfChildren); - ComputeOverflowAreas(*reflowState, aMetrics, bottomEdgeOfChildren); + ComputeFinalSize(*reflowState, state, aMetrics); + ComputeOverflowAreas(*reflowState, aMetrics); // Factor overflow container child bounds into the overflow area aMetrics.mOverflowAreas.UnionWith(ocBounds); // Factor pushed float child bounds into the overflow area @@ -1301,8 +1300,7 @@ void nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, nsBlockReflowState& aState, - nsHTMLReflowMetrics& aMetrics, - nscoord* aBottomEdgeOfChildren) + nsHTMLReflowMetrics& aMetrics) { const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE @@ -1457,7 +1455,6 @@ // Screen out negative heights --- can happen due to integer overflows :-( aMetrics.height = NS_MAX(0, aMetrics.height); - *aBottomEdgeOfChildren = bottomEdgeOfChildren; #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { @@ -1469,8 +1466,7 @@ void nsBlockFrame::ComputeOverflowAreas(const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aMetrics, - nscoord aBottomEdgeOfChildren) + nsHTMLReflowMetrics& aMetrics) { // Compute the overflow areas of our children // XXX_perf: This can be done incrementally. It is currently one of @@ -1493,26 +1489,6 @@ if (mBullet) { areas.UnionAllWith(mBullet->GetRect()); } - - // Factor in the bottom edge of the children. Child frames - // will be added to the overflow area as we iterate through the lines, - // but their margins won't, so we need to account for bottom margins - // here. If we're a scrolled block then we also need to account - // for the scrollframe's padding, which is logically below the - // bottom margins of the children. - nscoord bottomEdgeOfContents = aBottomEdgeOfChildren; - if (GetStyleContext()->GetPseudo() == nsCSSAnonBoxes::scrolledContent) { - // We're a scrolled frame; the scrollframe's padding should be added - // to the bottom edge of the children - bottomEdgeOfContents += aReflowState.mComputedPadding.bottom; - } - // REVIEW: For now, we do this for both visual and scrollable area, - // although when we make scrollable overflow area not be a subset of - // visual, we can change this. - NS_FOR_FRAME_OVERFLOW_TYPES(otype) { - nsRect& o = areas.Overflow(otype); - o.height = NS_MAX(o.YMost(), bottomEdgeOfContents) - o.y; - } } #ifdef NOISY_COMBINED_AREA ListTag(stdout); diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -383,12 +383,10 @@ virtual void ComputeFinalSize(const nsHTMLReflowState& aReflowState, nsBlockReflowState& aState, - nsHTMLReflowMetrics& aMetrics, - nscoord* aBottomEdgeOfChildren); + nsHTMLReflowMetrics& aMetrics); void ComputeOverflowAreas(const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aMetrics, - nscoord aBottomEdgeOfChildren); + nsHTMLReflowMetrics& aMetrics); /** add the frames in aFrameList to this block after aPrevSibling * this block thinks in terms of lines, but the frame construction code diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -6205,6 +6205,13 @@ nsRect& o = aOverflowAreas.Overflow(otype); o.UnionRectEdges(o, bounds); } + + // Include margin in scrollable overflow. + // XXX In theory this should consider margin collapsing + nsRect marginBounds(bounds); + marginBounds.Inflate(GetUsedMargin()); + nsRect &so = aOverflowAreas.ScrollableOverflow(); + so.UnionRectEdges(so, marginBounds); } // Note that NS_STYLE_OVERFLOW_CLIP doesn't clip the frame background,