Bug 841192. Part 15: Move DisplayListClipState clipping methods to AutoSaveRestore and AutoClipMultiple helper classes for safer usage. r=mattwoodrow

This commit is contained in:
Robert O'Callahan
2013-04-05 00:36:45 +13:00
parent 29d310bf8a
commit d7f7732507
10 changed files with 180 additions and 106 deletions

View File

@@ -117,31 +117,24 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
mRenderer.DisplayButton(aBuilder, aLists.BorderBackground(), &onTop);
}
bool overflowClip =
IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE;
nsRect rect;
nscoord radii[8];
nsDisplayListCollection set;
{
DisplayListClipState::AutoSaveRestore saveClipState(aBuilder->ClipState());
DisplayItemClip overflowClipOnStack;
// Do not allow the child subtree to receive events.
if (!aBuilder->IsForEventDelivery()) {
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (overflowClip) {
if (IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE) {
nsMargin border = StyleBorder()->GetComputedBorder();
rect = nsRect(aBuilder->ToReferenceFrame(this), GetSize());
nsRect rect(aBuilder->ToReferenceFrame(this), GetSize());
rect.Deflate(border);
nscoord radii[8];
bool hasRadii = GetPaddingBoxBorderRadii(radii);
aBuilder->ClipState().ClipContainingBlockDescendants(rect,
hasRadii ? radii : nullptr, overflowClipOnStack);
clipState.ClipContainingBlockDescendants(rect, hasRadii ? radii : nullptr);
}
// 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()
}
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