Bug 901339 - Fix the focal point when zooming in and out. r=BenWa
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 07 Aug 2013 12:34:16 -0400
changeset 141644 8427bf2c4652adbdc8a72f75ced906a93a8e047b
parent 141643 cbb253f535486f68ca852d1040e1ea476d8166f3
child 141645 a3e34b989ebe56661a6a29efb57d7084f6099f55
push id32178
push userkgupta@mozilla.com
push dateWed, 07 Aug 2013 16:34:53 +0000
treeherdermozilla-inbound@8427bf2c4652 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs901339
milestone26.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 901339 - Fix the focal point when zooming in and out. r=BenWa
gfx/layers/ipc/AsyncPanZoomController.cpp
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1150,22 +1150,23 @@ bool AsyncPanZoomController::SampleConte
   mLastSampleTime = aSampleTime;
 
   return requestAnimationFrame;
 }
 
 ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() {
   ReentrantMonitorAutoEnter lock(mMonitor);
 
-  LayerPoint metricsScrollOffset;
+  CSSPoint lastPaintScrollOffset;
   if (mLastContentPaintMetrics.IsScrollable()) {
-    metricsScrollOffset = mLastContentPaintMetrics.GetScrollOffsetInLayerPixels();
+    lastPaintScrollOffset = mLastContentPaintMetrics.mScrollOffset;
   }
   CSSToScreenScale localScale = mFrameMetrics.CalculateResolution();
-  LayerPoint translation = mFrameMetrics.GetScrollOffsetInLayerPixels() - metricsScrollOffset;
+  LayerPoint translation = (mFrameMetrics.mScrollOffset - lastPaintScrollOffset)
+                         * mLastContentPaintMetrics.LayersPixelsPerCSSPixel();
   return ViewTransform(-translation, localScale / mLastContentPaintMetrics.mDevPixelsPerCSSPixel);
 }
 
 void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) {
   ReentrantMonitorAutoEnter lock(mMonitor);
 
   mLastContentPaintMetrics = aLayerMetrics;