mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1205473 - Add a state bit to optimize building event regions. r=mattwoodrow
MozReview-Commit-ID: CPSgChJc92L
This commit is contained in:
parent
6da1ca03eb
commit
30f39f0a24
@ -3436,12 +3436,16 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
|
||||
// are the event targets for any regions viewport frames may cover.
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t pointerEvents = aFrame->StyleVisibility()->GetEffectivePointerEvents(aFrame);
|
||||
if (pointerEvents == NS_STYLE_POINTER_EVENTS_NONE) {
|
||||
return;
|
||||
}
|
||||
if (!aFrame->StyleVisibility()->IsVisible()) {
|
||||
return;
|
||||
bool simpleRegions = aFrame->HasAnyStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS);
|
||||
if (!simpleRegions) {
|
||||
if (!aFrame->StyleVisibility()->IsVisible()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// XXX handle other pointerEvents values for SVG
|
||||
|
||||
@ -3460,15 +3464,23 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
borderBox += aBuilder->ToReferenceFrame(aFrame);
|
||||
|
||||
bool borderBoxHasRoundedCorners = false;
|
||||
if (!simpleRegions) {
|
||||
if (nsLayoutUtils::HasNonZeroCorner(aFrame->StyleBorder()->mBorderRadius)) {
|
||||
borderBoxHasRoundedCorners = true;
|
||||
} else {
|
||||
aFrame->AddStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS);
|
||||
}
|
||||
}
|
||||
|
||||
const DisplayItemClip* clip = aBuilder->ClipState().GetCurrentCombinedClip(aBuilder);
|
||||
bool borderBoxHasRoundedCorners =
|
||||
nsLayoutUtils::HasNonZeroCorner(aFrame->StyleBorder()->mBorderRadius);
|
||||
if (clip) {
|
||||
borderBox = clip->ApplyNonRoundedIntersection(borderBox);
|
||||
if (clip->GetRoundedRectCount() > 0) {
|
||||
borderBoxHasRoundedCorners = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (borderBoxHasRoundedCorners ||
|
||||
(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
|
||||
mMaybeHitRegion.Or(mMaybeHitRegion, borderBox);
|
||||
|
@ -902,6 +902,8 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
PresContext()->SetBidiEnabled();
|
||||
}
|
||||
|
||||
RemoveStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS);
|
||||
}
|
||||
|
||||
// MSVC fails with link error "one or more multiply defined symbols found",
|
||||
|
@ -180,6 +180,12 @@ FRAME_STATE_BIT(Generic, 33, NS_FRAME_DRAWING_AS_PAINTSERVER)
|
||||
// situation (possibly the frame itself).
|
||||
FRAME_STATE_BIT(Generic, 34, NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)
|
||||
|
||||
// A flag that tells us we can take the common path with respect to style
|
||||
// properties for this frame when building event regions. This flag is cleared
|
||||
// when any styles are changed and then we recompute it on the next build
|
||||
// of the event regions.
|
||||
FRAME_STATE_BIT(Generic, 35, NS_FRAME_SIMPLE_EVENT_REGIONS)
|
||||
|
||||
// Frame is a display root and the retained layer tree needs to be updated
|
||||
// at the next paint via display list construction.
|
||||
// Only meaningful for display roots, so we don't really need a global state
|
||||
|
Loading…
Reference in New Issue
Block a user