Bug 628605 - TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/mobile/chrome/browser_formsZoom.js | Test timed out [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 25 Jan 2011 15:28:41 +0100
changeset 2685 813a292f3d911ee14e5ca5c09cdd7361e0088d94
parent 2684 3ed759b19be6e9287c60f0f42c74276070971919
child 2686 338b337f98af5c0d938abda5552a93172d18a9a7
push id2257
push uservnicolas@mozilla.com
push dateTue, 25 Jan 2011 14:33:22 +0000
reviewersmfinkle
bugs628605
Bug 628605 - TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/mobile/chrome/browser_formsZoom.js | Test timed out [r=mfinkle]
chrome/content/AnimatedZoom.js
chrome/content/bindings/browser.xml
--- a/chrome/content/AnimatedZoom.js
+++ b/chrome/content/AnimatedZoom.js
@@ -80,27 +80,30 @@ const AnimatedZoom = {
     let browser = getBrowser();
     let bcr = browser.getBoundingClientRect();
     let scroll = browser.getRootView().getPosition();
     return new Rect(scroll.x, scroll.y, bcr.width, bcr.height);
   },
 
   /** Update the visible rect, in device pixels relative to the content origin. */
   updateTo: function(nextRect) {
+    let browser = getBrowser();
     let zoomRatio = window.innerWidth / nextRect.width;
-    let zoomLevel = getBrowser().scale * zoomRatio;
+    let zoomLevel = browser.scale * zoomRatio;
+
     // XXX using the underlying frameLoader APIs is undesirable and is not a
     // pattern to propagate. The browser binding should be taking care of this!
     // There is some bug that I have not yet discovered that make browser.scrollTo
     // not behave correctly and there is no intelligence in browser.scale to keep
     // the actual resolution changes small.
     // * One bug is related to setting scale. See bug 626792.
-    let contentView = getBrowser()._contentViewManager.rootContentView;
+    let contentView = browser.getRootView();
     contentView.setScale(zoomLevel, zoomLevel);
     contentView.scrollTo(nextRect.left * zoomRatio, nextRect.top * zoomRatio);
+
     this.zoomRect = nextRect;
   },
 
   /** Stop animation, zoom to point, and clean up. */
   finish: function() {
     window.removeEventListener("MozBeforePaint", this, false);
     Browser.setVisibleRect(this.zoomTo || this.zoomRect);
     this.beginTime = null;
--- a/chrome/content/bindings/browser.xml
+++ b/chrome/content/bindings/browser.xml
@@ -447,16 +447,19 @@
 
           _updateCacheViewport: function() {
           },
 
           isRoot: function() {
             return true;
           },
 
+          setScale: function(aXScale, aYScale) {
+          },
+
           scrollBy: function(x, y) {
             let self = this.self;
             let position = this.getPosition();
             x = Math.floor(Math.max(0, Math.min(self.contentDocumentWidth,  position.x + x)) - position.x);
             y = Math.floor(Math.max(0, Math.min(self.contentDocumentHeight, position.y + y)) - position.y);
             self.contentWindow.scrollBy(x, y);
           },
 
@@ -710,16 +713,17 @@
           _getViewportSize: function() {},
 
           isRoot: function() {
             return true;
           },
 
           scrollBy: function(x, y) {},
           scrollTo: function(x, y) {},
+          setScale: function(aXScale, aYScale) {},
           getPosition: function() {
             return { x: 0, y: 0 };
           }
         })
       ]]></field>
 
       <field name="_contentViewPrototype"><![CDATA[
         ({
@@ -853,16 +857,21 @@
               this._updateCacheViewport();
           },
 
           scrollTo: function(x, y) {
             let contentView = this._contentView;
             this.scrollBy(x - contentView.scrollX, y - contentView.scrollY);
           },
 
+          setScale: function(aXScale, aYScale) {
+            let contentView = this._contentView;
+            contentView.setScale(aXScale, aYScale);
+          },
+
           getPosition: function() {
             let contentView = this._contentView;
             return { x: contentView.scrollX, y: contentView.scrollY };
           }
         })
         ]]>
       </field>
 
@@ -871,17 +880,17 @@
         <parameter name="scale"/>
         <body>
           <![CDATA[
             if (scale <= 0 || scale == this._scale)
               return;
 
             this._scale = scale;
             let rootView = this.getRootView();
-            rootView._contentView.setScale(scale, scale);
+            rootView.setScale(scale, scale);
             rootView._updateCacheViewport();
 
             let event = document.createEvent("Events");
             event.initEvent("ZoomChanged", true, false);
             this.dispatchEvent(event);
           ]]>
         </body>
       </method>