Bug 1416067 - Avoid doing a bunch of useless event-regions work for frames with empty border boxes. r?mstange
MozReview-Commit-ID: 8gsIJojhQ6t
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4834,21 +4834,16 @@ nsDisplayLayerEventRegions::AddFrame(nsD
}
bool simpleRegions = aFrame->HasAnyStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS);
if (!simpleRegions) {
if (!aFrame->StyleVisibility()->IsVisible()) {
return;
}
}
- if (aFrame != mFrame &&
- aBuilder->IsRetainingDisplayList()) {
- aFrame->AddDisplayItem(this);
- }
-
// XXX handle other pointerEvents values for SVG
// XXX Do something clever here for the common case where the border box
// is obviously entirely inside mHitRegion.
nsRect borderBox;
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(aFrame);
@@ -4857,16 +4852,25 @@ nsDisplayLayerEventRegions::AddFrame(nsD
// area corresponding to the overflow rect as well. Otherwise the parts of
// the overflow that are not occupied by descendants get skipped and the
// APZ code sends touch events to the content underneath instead.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1127773#c15.
borderBox = aFrame->GetScrollableOverflowRect();
} else {
borderBox = nsRect(nsPoint(0, 0), aFrame->GetSize());
}
+ if (borderBox.IsEmpty()) {
+ return;
+ }
+
+ if (aFrame != mFrame &&
+ aBuilder->IsRetainingDisplayList()) {
+ aFrame->AddDisplayItem(this);
+ }
+
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);