Bug 912144 - Use the composition bounds instead of the viewport for hit testing. r=BenWa
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 11 Sep 2013 18:17:27 -0400
changeset 146654 988953e0c2080e3e829666239e2455015a6b6e27
parent 146653 ce483735e803a650b37b8a334271b304bca93c1d
child 146655 2f11fad2f3070b0d1ea93d8585dbe1261d713d2c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersBenWa
bugs912144
milestone26.0a1
Bug 912144 - Use the composition bounds instead of the viewport for hit testing. r=BenWa
gfx/layers/composite/APZCTreeManager.cpp
gfx/layers/composite/ContainerLayerComposite.cpp
--- a/gfx/layers/composite/APZCTreeManager.cpp
+++ b/gfx/layers/composite/APZCTreeManager.cpp
@@ -129,17 +129,17 @@ APZCTreeManager::UpdatePanZoomController
           controller->SetPrevSibling(nullptr);
           controller->SetLastChild(nullptr);
         }
         APZC_LOG("Using APZC %p for layer %p with identifiers %lld %lld\n", controller, aLayer, aLayersId, container->GetFrameMetrics().mScrollId);
 
         controller->NotifyLayersUpdated(container->GetFrameMetrics(),
                                         aIsFirstPaint && (aLayersId == aFirstPaintLayersId));
 
-        LayerRect visible = container->GetFrameMetrics().mViewport * container->GetFrameMetrics().LayersPixelsPerCSSPixel();
+        LayerRect visible = ScreenRect(container->GetFrameMetrics().mCompositionBounds) * ScreenToLayerScale(1.0);
         controller->SetLayerHitTestData(visible, aTransform, aLayer->GetTransform());
         APZC_LOG("Setting rect(%f %f %f %f) as visible region for APZC %p\n", visible.x, visible.y,
                                                                               visible.width, visible.height,
                                                                               controller);
 
         // Bind the APZC instance into the tree of APZCs
         if (aNextSibling) {
           aNextSibling->SetPrevSibling(controller);
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -180,18 +180,18 @@ ContainerRender(ContainerT* aContainer,
                                         transform, gfx::Point(aOffset.x, aOffset.y));
   }
 
   if (aContainer->GetFrameMetrics().IsScrollable()) {
     gfx::Matrix4x4 transform;
     ToMatrix4x4(aContainer->GetEffectiveTransform(), transform);
 
     const FrameMetrics& frame = aContainer->GetFrameMetrics();
-    LayerRect layerViewport = frame.mViewport * frame.LayersPixelsPerCSSPixel();
-    gfx::Rect rect(layerViewport.x, layerViewport.y, layerViewport.width, layerViewport.height);
+    LayerRect layerBounds = ScreenRect(frame.mCompositionBounds) * ScreenToLayerScale(1.0);
+    gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
     gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
     aManager->GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTAINER,
                                                rect, clipRect,
                                                transform, gfx::Point(aOffset.x, aOffset.y));
   }
 }
 
 ContainerLayerComposite::ContainerLayerComposite(LayerManagerComposite *aManager)