Bug 665597 - Include margin calculations in FinishAndStoreOverflow. part=1/5 r=roc

This commit is contained in:
Benjamin Stover 2011-06-20 10:03:09 -07:00
parent bdd5a1b56d
commit 79f944693c
2 changed files with 11 additions and 13 deletions

View File

@ -1478,24 +1478,15 @@ nsBlockFrame::ComputeOverflowAreas(const nsHTMLReflowState& aReflowState,
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;
}
// 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.
// 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;
o.height = NS_MAX(o.YMost(), aBottomEdgeOfChildren) - o.y;
}
}
#ifdef NOISY_COMBINED_AREA

View File

@ -6598,6 +6598,13 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
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,