From 4c6b48d9b8b2336226ab3d7fbcf3384f9a29de32 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 28 Aug 2014 20:11:07 -0400 Subject: [PATCH] Bug 1058664 - Update the LD transform to go with the changes in bug 1052063. r=botond --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index e03517feeaf..52b0020d31b 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2397,9 +2397,20 @@ Matrix4x4 AsyncPanZoomController::GetNontransientAsyncTransform() { Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() { ReentrantMonitorAutoEnter lock(mMonitor); - LayerPoint scrollChange = (mLastContentPaintMetrics.GetScrollOffset() - mLastDispatchedPaintMetrics.GetScrollOffset()) - * mLastContentPaintMetrics.LayersPixelsPerCSSPixel(); + + // Technically we should be taking the scroll delta in the coordinate space + // of transformed layer pixels (i.e. this layer's LayerPixels, with the layer + // transform applied). However in the absence of actual CSS transforms, we + // can use the parent-layer space instead. + // When we fix bug 993525 and properly support CSS transforms we might have + // to revisit this. + ParentLayerPoint scrollChange = + (mLastContentPaintMetrics.GetScrollOffset() - mLastDispatchedPaintMetrics.GetScrollOffset()) + * mLastContentPaintMetrics.mDevPixelsPerCSSPixel + * mLastContentPaintMetrics.GetParentResolution(); + float zoomChange = mLastContentPaintMetrics.GetZoom().scale / mLastDispatchedPaintMetrics.GetZoom().scale; + return Matrix4x4().Translate(scrollChange.x, scrollChange.y, 0) * Matrix4x4().Scale(zoomChange, zoomChange, 1); }