Enable zooming.
authorAli Juma <ajuma@mozilla.com>
Sun, 12 Feb 2012 15:06:34 -0500
changeset 89125 f290028f4842831ac03990fbcb2bd1bef8d0a994
parent 89124 2a128563daedfa8bc1e2b1b9c312f958255292dc
child 89126 da5a0253074ee71d1913dab6f0e3b1a2ffb597af
push idunknown
push userunknown
push dateunknown
milestone13.0a1
Enable zooming.
gfx/layers/ipc/CompositorParent.cpp
mobile/android/chrome/content/browser.js
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -279,18 +279,18 @@ CompositorParent::TransformShadowTree(La
   ViewTransform layerTransform = aTransform;
 
   ContainerLayer* container = aLayer->AsContainerLayer();
 
   if (container && container->GetFrameMetrics().IsScrollable()) {
     const FrameMetrics* metrics = &container->GetFrameMetrics();
     const gfx3DMatrix& currentTransform = aLayer->GetTransform();
 
-    aTempScaleDiffX *= GetXScale(shadowTransform);
-    aTempScaleDiffY *= GetYScale(shadowTransform);
+    aTempScaleDiffX *= GetXScale(shadowTransform) * mXScale;
+    aTempScaleDiffY *= GetYScale(shadowTransform) * mYScale;
 
     nsIntPoint metricsScrollOffset = metrics->mViewportScrollOffset;
 
     nsIntPoint scrollCompensation(
         (mScrollOffset.x / aTempScaleDiffX - metricsScrollOffset.x) * mXScale,
         (mScrollOffset.y / aTempScaleDiffY - metricsScrollOffset.y) * mYScale);
     ViewTransform treeTransform(-scrollCompensation, mXScale,
                                 mYScale);
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1580,19 +1580,20 @@ Tab.prototype = {
       this.viewportExcess.x = excessX;
     }
     if ((aViewport.offsetY != this._viewport.offsetY) ||
         (excessY != this.viewportExcess.y)) {
       this._viewport.offsetY = aViewport.offsetY;
       this.viewportExcess.y = excessY;
     }
     if (Math.abs(aViewport.zoom - this._viewport.zoom) >= 1e-6) {
-      //FIXME: Uncomment once zoom is working again.
-      //this._viewport.zoom = aViewport.zoom;
-      this._viewport.zoom = 1;
+      this._viewport.zoom = aViewport.zoom;
+      let cwu = window.top.QueryInterface(Ci.nsIInterfaceRequestor)
+                           .getInterface(Ci.nsIDOMWindowUtils);
+      cwu.setResolution(this._viewport.zoom, this._viewport.zoom);
     }
   },
 
   screenshot: function(aSrc, aDst) {
       // FIXME: Reenable
       //if (!this.browser || !this.browser.contentWindow)
         return;
 
@@ -1668,19 +1669,17 @@ Tab.prototype = {
 
   updateViewport: function(aReset, aZoomLevel) {
     dump("### JS side updateViewport " + aReset + " zoom " + aZoomLevel + "\n");
 
     if (!aZoomLevel)
       aZoomLevel = this.getDefaultZoomLevel();
 
     let win = this.browser.contentWindow;
-    //FIXME: Uncomment when zoom is working again.
-    //let zoom = (aReset ? aZoomLevel : this._viewport.zoom);
-    let zoom = 1;
+    let zoom = (aReset ? aZoomLevel : this._viewport.zoom);
     let xpos = ((aReset && win) ? win.scrollX * zoom : this._viewport.x);
     let ypos = ((aReset && win) ? win.scrollY * zoom : this._viewport.y);
 
     this.viewportExcess = { x: 0, y: 0 };
     this.viewport = { x: xpos, y: ypos,
                       offsetX: 0, offsetY: 0,
                       width: this._viewport.width, height: this._viewport.height,
                       pageWidth: gScreenWidth, pageHeight: gScreenHeight,