Bug 1436415 - Part 2: Enable nsIFrame::BuildDisplayListForChild() fast-path when using simple event region items draft
authorMiko Mynttinen <mikokm@gmail.com>
Tue, 13 Feb 2018 01:55:27 +0100
changeset 754255 a3c2e0d3ffe8c6bc295bd94310fe68a17c80ebfe
parent 754253 0e9a40cb155d2b927c6acbc4d08e0ded57c999ac
push id98805
push userbmo:mikokm@gmail.com
push dateTue, 13 Feb 2018 00:58:54 +0000
bugs1436415
milestone60.0a1
Bug 1436415 - Part 2: Enable nsIFrame::BuildDisplayListForChild() fast-path when using simple event region items MozReview-Commit-ID: 77rwS0cDUnn
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3492,21 +3492,24 @@ nsIFrame::BuildDisplayListForChild(nsDis
   }
 
   nsIFrame* child = aChild;
   if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
     return;
 
   aBuilder->ClearWillChangeBudget(child);
 
+  const bool buildEventRegionItems = aBuilder->IsBuildingLayerEventRegions() ||
+    aBuilder->BuildCompositorHitTestInfo();
+
   const bool doingShortcut =
     (child->GetStateBits() & NS_FRAME_SIMPLE_DISPLAYLIST) &&
     aBuilder->IsPaintingToWindow() &&
     // This would be changed by the change of preference.
-    aBuilder->IsBuildingLayerEventRegions() &&
+    buildEventRegionItems &&
     // Animations may change the value of |HasOpacity()|.
     !(child->GetContent() &&
       child->GetContent()->MayHaveAnimations());
 
   // dirty rect in child-relative coordinates
   NS_ASSERTION(aBuilder->GetCurrentFrame() == this, "Wrong coord space!");
   const nsPoint offset = child->GetOffsetTo(this);
   nsRect visible = aBuilder->GetVisibleRect() - offset;
@@ -3778,23 +3781,23 @@ nsIFrame::BuildDisplayListForChild(nsDis
         } else {
           aLists.BorderBackground()->AppendToTop(eventRegions);
         }
       } else {
         nsDisplayLayerEventRegions* eventRegions = aBuilder->GetLayerEventRegions();
         if (eventRegions) {
           eventRegions->AddFrame(aBuilder, child);
         }
-        if (!awayFromCommonPath &&
-            aBuilder->IsPaintingToWindow() &&
-            !buildingForChild.MaybeAnimatedGeometryRoot()) {
-          // The shortcut is available for the child for next time.
-          child->AddStateBits(NS_FRAME_SIMPLE_DISPLAYLIST);
-        }
-      }
+      }
+    }
+
+    if (!awayFromCommonPath && !differentAGR && buildEventRegionItems &&
+        aBuilder->IsPaintingToWindow()) {
+      // The shortcut is available for the child for next time.
+      child->AddStateBits(NS_FRAME_SIMPLE_DISPLAYLIST);
     }
 
     if (!pseudoStackingContext) {
       // THIS IS THE COMMON CASE.
       // Not a pseudo or real stacking context. Do the simple thing and
       // return early.
 
       aBuilder->AdjustWindowDraggingRegion(child);