Bug 841192. Part 14: Convert all usage of nsDisplayClip(RoundedRect) to use DisplayListClipState/DisplayItemClip. r=mattwoodrow

This patch does several things. Sorry.

In BuildDisplayList implementations, instead of wrapping display items in nsDisplayClip, we
push clip state onto the nsDisplayListBuilder and give the display items an
explicit clip when they're created.

In FrameLayerBuilder, we use the explicit clips we find on display items instead of
computing our own.

We remove nsDisplayClip and everything that depends on it.

We remove ExplodeAnonymousChildLists. With nsDisplayClip gone, and
nsDisplayOptionEventGrabber removed in a previous patch, there are no
anonymous child lists.

nsDisplayItem::TryMerge implementations need to make sure they have the same
clip before being merged.

I ripped out the part of PruneDisplayListForExtraPage that adjusts clip rects.
As far as I can tell, it isn't actually necessary.
This commit is contained in:
Robert O'Callahan
2013-03-04 22:56:02 +13:00
parent f9819ba6db
commit 29d310bf8a
22 changed files with 581 additions and 989 deletions

View File

@@ -116,31 +116,37 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (IsVisibleForPainting(aBuilder)) {
mRenderer.DisplayButton(aBuilder, aLists.BorderBackground(), &onTop);
}
bool overflowClip =
IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE;
nsRect rect;
nscoord radii[8];
nsDisplayListCollection set;
// Do not allow the child subtree to receive events.
if (!aBuilder->IsForEventDelivery()) {
BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), aDirtyRect, set,
DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT);
// That should put the display items in set.Content()
{
DisplayListClipState::AutoSaveRestore saveClipState(aBuilder->ClipState());
DisplayItemClip overflowClipOnStack;
if (overflowClip) {
nsMargin border = StyleBorder()->GetComputedBorder();
rect = nsRect(aBuilder->ToReferenceFrame(this), GetSize());
rect.Deflate(border);
bool hasRadii = GetPaddingBoxBorderRadii(radii);
aBuilder->ClipState().ClipContainingBlockDescendants(rect,
hasRadii ? radii : nullptr, overflowClipOnStack);
}
// Do not allow the child subtree to receive events.
if (!aBuilder->IsForEventDelivery()) {
BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), aDirtyRect, set,
DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT);
// That should put the display items in set.Content()
}
}
// Put the foreground outline and focus rects on top of the children
set.Content()->AppendToTop(&onTop);
// clips to our padding box for <input>s but not <button>s, unless
// they have non-visible overflow..
if (IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE) {
nsMargin border = StyleBorder()->GetComputedBorder();
nsRect rect(aBuilder->ToReferenceFrame(this), GetSize());
rect.Deflate(border);
nscoord radii[8];
GetPaddingBoxBorderRadii(radii);
OverflowClip(aBuilder, set, aLists, rect, radii);
} else {
set.MoveTo(aLists);
}
set.MoveTo(aLists);
DisplayOutline(aBuilder, aLists);