From 5ee0e769452b8d192814e599a6283751106b9d06 Mon Sep 17 00:00:00 2001 From: Dmitry Rozhkov Date: Thu, 6 Feb 2014 11:57:42 +0200 Subject: [PATCH] Bug 968222 - Update zoom scale in APZC upon orientation change. r=botond,kats From f60ff14c5fdd1f7fef29ea5b2d7b4c8fa5710157 Mon Sep 17 00:00:00 2001 --- gfx/layers/ipc/AsyncPanZoomController.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- gfx/layers/ipc/AsyncPanZoomController.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index 5a8fd64b4cc6..f7f480878b28 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -1656,11 +1656,17 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri // If we're not taking the aLayerMetrics wholesale we still need to pull // in some things into our local mFrameMetrics because these things are // determined by Gecko and our copy in mFrameMetrics may be stale. + + if (mFrameMetrics.mCompositionBounds.width == aLayerMetrics.mCompositionBounds.width) { + float parentResolutionChange = aLayerMetrics.GetParentResolution().scale + / mFrameMetrics.GetParentResolution().scale; + mFrameMetrics.mZoom.scale *= parentResolutionChange; + } else { + // Take the new zoom as composition width got changed (i.e. due to orientation change) + mFrameMetrics.mZoom.scale = aLayerMetrics.mZoom.scale; + } mFrameMetrics.mScrollableRect = aLayerMetrics.mScrollableRect; mFrameMetrics.mCompositionBounds = aLayerMetrics.mCompositionBounds; - float parentResolutionChange = aLayerMetrics.GetParentResolution().scale - / mFrameMetrics.GetParentResolution().scale; - mFrameMetrics.mZoom.scale *= parentResolutionChange; mFrameMetrics.mResolution = aLayerMetrics.mResolution; mFrameMetrics.mCumulativeResolution = aLayerMetrics.mCumulativeResolution; mFrameMetrics.mHasScrollgrab = aLayerMetrics.mHasScrollgrab;