Bug 1389146 - Enable WR hit-testing when the pref is enabled. r?mstange,botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 28 Nov 2017 15:28:09 -0500
changeset 704702 11c09a4aee45f045981c58a622deb64166a5ee87
parent 704701 40d6a68932a967d04346660ea6c2ce8f53b26f17
child 742126 c0b64a1a3bf9541db582e891de2d96bc3bd45025
push id91208
push userkgupta@mozilla.com
push dateTue, 28 Nov 2017 20:31:12 +0000
reviewersmstange, botond
bugs1389146
milestone59.0a1
Bug 1389146 - Enable WR hit-testing when the pref is enabled. r?mstange,botond This drops the code that compares the WR and Gecko hit-test results when WR is enabled, because the "baseline" Gecko hit-test result is not correct enough to provide a useful comparison. Instead flipping the pref now just enables the WR hit-test code; we will rely on automated testing to check for correctness. MozReview-Commit-ID: 8IFtk0p2NvE
gfx/layers/apz/src/APZCTreeManager.cpp
layout/painting/nsDisplayList.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -2214,40 +2214,20 @@ APZCTreeManager::GetTargetAPZC(const Scr
                                CompositorHitTestInfo* aOutHitResult,
                                RefPtr<HitTestingTreeNode>* aOutScrollbarNode)
 {
   MutexAutoLock lock(mTreeLock);
 
   CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;
   HitTestingTreeNode* scrollbarNode = nullptr;
   RefPtr<AsyncPanZoomController> target;
-  target = GetAPZCAtPoint(mRootNode, aPoint, &hitResult, &scrollbarNode);
-
   if (gfxPrefs::WebRenderHitTest()) {
-    CompositorHitTestInfo wrHitResult = CompositorHitTestInfo::eInvisibleToHitTest;
-    HitTestingTreeNode* wrScrollbarNode = nullptr;
-    RefPtr<AsyncPanZoomController> wrTarget = GetAPZCAtPointWR(aPoint, &wrHitResult, &wrScrollbarNode);
-    // For now just compare the WR and non-WR results.
-    if (wrHitResult != hitResult) {
-      printf_stderr("WR hit result mismatch at %s: got 0x%x, expected 0x%x\n",
-          Stringify(aPoint).c_str(), (int)wrHitResult, (int)hitResult);
-      // MOZ_RELEASE_ASSERT(false);
-    }
-    if (wrTarget.get() != target.get()) {
-      printf_stderr("WR hit target mismatch at %s: got %s, expected %s\n",
-          Stringify(aPoint).c_str(),
-          wrTarget ? Stringify(wrTarget->GetGuid()).c_str() : "null",
-          target ? Stringify(target->GetGuid()).c_str() : "null");
-      // MOZ_RELEASE_ASSERT(false);
-    }
-    if (wrScrollbarNode != scrollbarNode) {
-      printf_stderr("WR scrollbar node mismatch at %s: got %p, expected %p\n",
-          Stringify(aPoint).c_str(), wrScrollbarNode, scrollbarNode);
-      // MOZ_RELEASE_ASSERT(false);
-    }
+    target = GetAPZCAtPointWR(aPoint, &hitResult, &scrollbarNode);
+  } else {
+    target = GetAPZCAtPoint(mRootNode, aPoint, &hitResult, &scrollbarNode);
   }
 
   if (aOutHitResult) {
     *aOutHitResult = hitResult;
   }
   if (aOutScrollbarNode) {
     *aOutScrollbarNode = scrollbarNode;
   }
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2149,16 +2149,22 @@ nsDisplayListBuilder::AppendNewScrollInf
   MOZ_ASSERT(ShouldBuildScrollInfoItemsForHoisting());
   MOZ_ASSERT(mScrollInfoItemsForHoisting);
   mScrollInfoItemsForHoisting->AppendNewToTop(aScrollInfoItem);
 }
 
 bool
 nsDisplayListBuilder::IsBuildingLayerEventRegions()
 {
+  if (mBuildCompositorHitTestInfo) {
+    // If we have webrender hit-testing enabled, then we will build the
+    // nsDisplayCompositorHitTestInfo items and use those instead of event
+    // regions, so we don't need to build the event regions.
+    return false;
+  }
   if (IsPaintingToWindow()) {
     // Note: this function and LayerEventRegionsEnabled are the only places
     // that get to query LayoutEventRegionsEnabled 'directly' - other code
     // should call this function.
     return gfxPrefs::LayoutEventRegionsEnabledDoNotUseDirectly() ||
            mAsyncPanZoomEnabled;
   }
   return false;