Bug 798245 - Propagate the zoom from the tab child into the frame metrics. r=cjones, a=blocking-basecamp
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 11 Dec 2012 17:49:57 -0500
changeset 122170 4dba9c208e9aa5f57b894708f0f562807bcdee38
parent 122169 c999276c8c1855d088fd85a2d3ba5162262c4234
child 122171 5d10c266fa868749b43224f977edcf5dfdc7b006
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones, blocking-basecamp
bugs798245
milestone19.0a2
Bug 798245 - Propagate the zoom from the tab child into the frame metrics. r=cjones, a=blocking-basecamp This lets the default zoom make it back to the APZC when the viewport is set.
dom/ipc/TabChild.h
layout/base/nsDisplayList.cpp
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -286,16 +286,18 @@ public:
 
     JSContext* GetJSContext() { return mCx; }
 
     nsIPrincipal* GetPrincipal() { return mPrincipal; }
 
     /** Return the DPI of the widget this TabChild draws to. */
     void GetDPI(float* aDPI);
 
+    gfxSize GetZoom() { return mLastMetrics.mZoom; }
+
     void SetBackgroundColor(const nscolor& aColor);
 
     void NotifyPainted();
 
     bool IsAsyncPanZoomEnabled();
 
     /**
      * Signal to this TabChild that it should be made visible:
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -5,16 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 /*
  * structures that represent things to be painted (ordered in z-order),
  * used during painting and hit testing
  */
 
+// include PBrowserChild explicitly because TabChild won't include it
+// because we're in layout :(
+#include "mozilla/dom/PBrowserChild.h"
+#include "mozilla/dom/TabChild.h"
+
 #include "mozilla/layers/PLayers.h"
 
 #include "nsDisplayList.h"
 
 #include "nsCSSRendering.h"
 #include "nsRenderingContext.h"
 #include "nsISelectionController.h"
 #include "nsIPresShell.h"
@@ -45,16 +50,17 @@
 #include "ImageLayers.h"
 #include "ImageContainer.h"
 
 #include "mozilla/StandardInteger.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::layers;
+using namespace mozilla::dom;
 typedef FrameMetrics::ViewID ViewID;
 
 static void AddTransformFunctions(nsCSSValueList* aList,
                                   nsStyleContext* aContext,
                                   nsPresContext* aPresContext,
                                   nsRect& aBounds,
                                   float aAppUnitsPerPixel,
                                   InfallibleTArray<TransformFunction>& aFunctions)
@@ -653,16 +659,19 @@ static void RecordFrameMetrics(nsIFrame*
                          nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
     metrics.mContentRect = contentBounds.ScaleToNearestPixels(
       aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
   }
 
   metrics.mScrollId = aScrollId;
 
   nsIPresShell* presShell = presContext->GetPresShell();
+  if (TabChild *tc = GetTabChildFrom(presShell)) {
+    metrics.mZoom = tc->GetZoom();
+  }
   metrics.mResolution = gfxSize(presShell->GetXResolution(), presShell->GetYResolution());
 
   metrics.mDevPixelsPerCSSPixel = auPerCSSPixel / auPerDevPixel;
 
   metrics.mMayHaveTouchListeners = aMayHaveTouchListeners;
 
   if (nsIWidget* widget = aForFrame->GetNearestWidget()) {
     widget->GetBounds(metrics.mCompositionBounds);