Bug 1601527. In APZCTreeManager::ReceiveInputEvent for pinch gesture inputs adjust the target apzc to the root content. r?botond draft
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 04 Dec 2019 21:05:22 -0600
changeset 2517416 b3c0fb9928dab79dd15c570fa7a13d3136f3b41d
parent 2516758 32f84899fc000d95337a25c14a27470d0c52e3ee
child 2517417 83f36cf4a9d89a525bbb3a1773179f2844a2c612
push id460520
push usertnikkel@gmail.com
push dateThu, 05 Dec 2019 03:12:35 +0000
treeherdertry@58ff44087045 [default view] [failures only]
reviewersbotond
bugs1601527
milestone73.0a1
Bug 1601527. In APZCTreeManager::ReceiveInputEvent for pinch gesture inputs adjust the target apzc to the root content. r?botond Otherwise we hit this assert https://searchfox.org/mozilla-central/rev/efdf9bb55789ea782ae3a431bda6be74a87b041e/gfx/layers/apz/src/AsyncPanZoomController.cpp#1209 The adjusting mentioned in that comment doesn't seem to happen on the path that macOS pinch gesture events use.
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1569,35 +1569,42 @@ APZEventResult APZCTreeManager::ReceiveI
       break;
     }
     case PINCHGESTURE_INPUT: {  // note: no one currently sends these
       PinchGestureInput& pinchInput = aEvent.AsPinchGestureInput();
       HitTestResult hit = GetTargetAPZC(pinchInput.mFocusPoint);
       aEvent.mLayersId = hit.mLayersId;
       hitResult = hit.mHitResult;
 
-      if (hit.mTargetApzc) {
+      RefPtr<AsyncPanZoomController> targetApzc = hit.mTargetApzc;
+      if (targetApzc) {
         MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
 
+        if (!targetApzc->IsRootContent()) {
+          targetApzc = FindZoomableApzc(targetApzc);
+        }
+      }
+
+      if (targetApzc) {
         ScreenToScreenMatrix4x4 outTransform =
             GetScreenToApzcTransform(hit.mTargetApzc) *
             GetApzcToGeckoTransform(hit.mTargetApzc);
         Maybe<ScreenPoint> untransformedFocusPoint =
             UntransformBy(outTransform, pinchInput.mFocusPoint);
 
         if (!untransformedFocusPoint) {
           return result;
         }
 
         result.mStatus = mInputQueue->ReceiveInputEvent(
-            hit.mTargetApzc, TargetConfirmationFlags{hitResult}, pinchInput,
+            targetApzc, TargetConfirmationFlags{hitResult}, pinchInput,
             &result.mInputBlockId);
 
         // Update the out-parameters so they are what the caller expects.
-        hit.mTargetApzc->GetGuid(&result.mTargetGuid);
+        targetApzc->GetGuid(&result.mTargetGuid);
         pinchInput.mFocusPoint = *untransformedFocusPoint;
       }
       break;
     }
     case TAPGESTURE_INPUT: {  // note: no one currently sends these
       TapGestureInput& tapInput = aEvent.AsTapGestureInput();
       HitTestResult hit = GetTargetAPZC(tapInput.mPoint);
       aEvent.mLayersId = hit.mLayersId;