Bug 1581233 - Add a helper function to reduce repetition at the call sites of HitTestingTreeNode::SetHitTestData(). r=tnikkel
authorBotond Ballo <botond@mozilla.com>
Sat, 14 Sep 2019 09:01:22 +0000
changeset 554500 fd34209bdecb327b012f1457fc1922c93c940a5b
parent 554499 54f895ee30ef8150582654d153bf674eaea1f68d
child 554501 a8b8823a6b72114f4150fbcd2ab0728b833b6a04
push id12169
push userffxbld-merge
push dateMon, 14 Oct 2019 16:59:29 +0000
treeherdermozilla-beta@c819687300ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1581233
milestone71.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 1581233 - Add a helper function to reduce repetition at the call sites of HitTestingTreeNode::SetHitTestData(). r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D45916
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -925,16 +925,27 @@ void APZCTreeManager::NotifyAutoscrollRe
     const ScrollableLayerGuid& aGuid) const {
   RefPtr<GeckoContentController> controller =
       GetContentController(aGuid.mLayersId);
   MOZ_ASSERT(controller);
   controller->NotifyAsyncAutoscrollRejected(aGuid.mScrollId);
 }
 
 template <class ScrollNode>
+void SetHitTestData(HitTestingTreeNode* aNode, HitTestingTreeNode* aParent,
+                    const ScrollNode& aLayer,
+                    const Maybe<ParentLayerIntRegion>& aClipRegion) {
+  aNode->SetHitTestData(
+      GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
+      aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), aClipRegion,
+      GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
+      !!aLayer.IsAsyncZoomContainer());
+}
+
+template <class ScrollNode>
 HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
     const RecursiveMutexAutoLock& aProofOfTreeLock, const ScrollNode& aLayer,
     const FrameMetrics& aMetrics, LayersId aLayersId,
     const AncestorTransform& aAncestorTransform, HitTestingTreeNode* aParent,
     HitTestingTreeNode* aNextSibling, TreeBuildingState& aState,
     wr::RenderRoot aRenderRoot) {
   bool needsApzc = true;
   if (!aMetrics.IsScrollable()) {
@@ -964,24 +975,20 @@ HitTestingTreeNode* APZCTreeManager::Pre
 
   RefPtr<HitTestingTreeNode> node = nullptr;
   if (!needsApzc) {
     // Note: if layer properties must be propagated to nodes, RecvUpdate in
     // LayerTransactionParent.cpp must ensure that APZ will be notified
     // when those properties change.
     node = RecycleOrCreateNode(aProofOfTreeLock, aState, nullptr, aLayersId);
     AttachNodeToTree(node, aParent, aNextSibling);
-    node->SetHitTestData(
-        GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
-        aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(),
-        (!parentHasPerspective && aLayer.GetClipRect())
-            ? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
-            : Nothing(),
-        GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
-        !!aLayer.IsAsyncZoomContainer());
+    SetHitTestData(node, aParent, aLayer,
+                   (!parentHasPerspective && aLayer.GetClipRect())
+                       ? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
+                       : Nothing());
     node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
                            aLayer.GetScrollbarData());
     node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
     return node;
   }
 
   AsyncPanZoomController* apzc = nullptr;
   // If we get here, aLayer is a scrollable layer and somebody
@@ -1090,21 +1097,17 @@ HitTestingTreeNode* APZCTreeManager::Pre
     // Since this is the first time we are encountering an APZC with this guid,
     // the node holding it must be the primary holder. It may be newly-created
     // or not, depending on whether it went through the newApzc branch above.
     MOZ_ASSERT(node->IsPrimaryHolder() && node->GetApzc() &&
                node->GetApzc()->Matches(guid));
 
     Maybe<ParentLayerIntRegion> clipRegion =
         parentHasPerspective ? Nothing() : ComputeClipRegion(aLayer);
-    node->SetHitTestData(
-        GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
-        aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), clipRegion,
-        GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
-        !!aLayer.IsAsyncZoomContainer());
+    SetHitTestData(node, aParent, aLayer, clipRegion);
     apzc->SetAncestorTransform(aAncestorTransform);
 
     PrintAPZCInfo(aLayer, apzc);
 
     // Bind the APZC instance into the tree of APZCs
     AttachNodeToTree(node, aParent, aNextSibling);
 
     // For testing, log the parent scroll id of every APZC that has a
@@ -1194,21 +1197,17 @@ HitTestingTreeNode* APZCTreeManager::Pre
       } else {
         aState.mPerspectiveTransformsDeferredToChildren.insert(
             PairType{apzc, aAncestorTransform.GetPerspectiveTransform()});
       }
     }
 
     Maybe<ParentLayerIntRegion> clipRegion =
         parentHasPerspective ? Nothing() : ComputeClipRegion(aLayer);
-    node->SetHitTestData(
-        GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
-        aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), clipRegion,
-        GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
-        !!aLayer.IsAsyncZoomContainer());
+    SetHitTestData(node, aParent, aLayer, clipRegion);
   }
 
   // Note: if layer properties must be propagated to nodes, RecvUpdate in
   // LayerTransactionParent.cpp must ensure that APZ will be notified
   // when those properties change.
   node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
                          aLayer.GetScrollbarData());
   node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());