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 754464 9d1815acfc30ccd718c8db7c9db4a7b1b09835ac
parent 754253 0e9a40cb155d2b927c6acbc4d08e0ded57c999ac
push id98885
push userbmo:mikokm@gmail.com
push dateTue, 13 Feb 2018 16:33:03 +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,22 @@ nsIFrame::BuildDisplayListForChild(nsDis
   }
 
   nsIFrame* child = aChild;
   if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
     return;
 
   aBuilder->ClearWillChangeBudget(child);
 
-  const bool doingShortcut =
+  const bool shortcutPossible = aBuilder->IsPaintingToWindow() &&
+    (aBuilder->IsBuildingLayerEventRegions() ||
+     aBuilder->BuildCompositorHitTestInfo());
+
+  const bool doingShortcut = shortcutPossible &&
     (child->GetStateBits() & NS_FRAME_SIMPLE_DISPLAYLIST) &&
-    aBuilder->IsPaintingToWindow() &&
-    // This would be changed by the change of preference.
-    aBuilder->IsBuildingLayerEventRegions() &&
     // 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 +3779,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 && shortcutPossible &&
+        !differentAGR && !buildingForChild.MaybeAnimatedGeometryRoot()) {
+      // 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);