Bug 1416067 - Avoid doing a bunch of useless event-regions work for frames with empty border boxes. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 09 Nov 2017 19:40:44 -0500
changeset 444495 e7f0ad15263103e680bfd1d17e37497cc349106a
parent 444494 40f071c58bf9fc1d6c3afcea0267d5f98ad523a6
child 444496 5e6769924323b3c375ca2ee45b7315e8dbaa6122
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1416067
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1416067 - Avoid doing a bunch of useless event-regions work for frames with empty border boxes. r=mstange MozReview-Commit-ID: 8gsIJojhQ6t
layout/painting/nsDisplayList.cpp
--- 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);