Remove CSS transforms as they're basically incompatible with displayports
authorPatrick Walton <pwalton@mozilla.com>
Wed, 08 Feb 2012 13:12:12 -0800
changeset 90911 e57d575c2da1c94067e7514d85762b6ea8f3f8fb
parent 90909 932a5ef6c872505e19cc30370b1f931fd4b6e56a
child 90914 841821abc30a7e9c4b53edb8087e014f3e6e3e42
push idunknown
push userunknown
push dateunknown
milestone12.0a1
Remove CSS transforms as they're basically incompatible with displayports
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -847,37 +847,30 @@ var BrowserApp = {
       // and adjust it by viewportExcess to so that it is relative to what the user sees as the viewport.
       let focusedRect = focused.getBoundingClientRect();
       focusedRect = {
         left: focusedRect.left - tab.viewportExcess.x,
         right: focusedRect.right - tab.viewportExcess.x,
         top: focusedRect.top - tab.viewportExcess.y,
         bottom: focusedRect.bottom - tab.viewportExcess.y
       };
-      let transformChanged = false;
       if (focusedRect.right >= visibleContentWidth && focusedRect.left > 0) {
         // the element is too far off the right side, so we need to scroll to the right more
         tab.viewportExcess.x += Math.min(focusedRect.left, focusedRect.right - visibleContentWidth);
-        transformChanged = true;
       } else if (focusedRect.left < 0) {
         // the element is too far off the left side, so we need to scroll to the left more
         tab.viewportExcess.x += focusedRect.left;
-        transformChanged = true;
       }
       if (focusedRect.bottom >= visibleContentHeight && focusedRect.top > 0) {
         // the element is too far down, so we need to scroll down more
         tab.viewportExcess.y += Math.min(focusedRect.top, focusedRect.bottom - visibleContentHeight);
-        transformChanged = true;
       } else if (focusedRect.top < 0) {
         // the element is too far up, so we need to scroll up more
         tab.viewportExcess.y += focusedRect.top;
-        transformChanged = true;
       }
-      if (transformChanged)
-        tab.updateTransform();
       // finally, let java know where we ended up
       tab.sendViewportUpdate();
     }
   },
 
   getDrawMetadata: function getDrawMetadata() {
     let viewport = this.selectedTab.viewport;
 
@@ -1426,17 +1419,16 @@ Tab.prototype = {
     this.vbox.align = "start";
     BrowserApp.deck.appendChild(this.vbox);
 
     this.browser = document.createElement("browser");
     this.browser.setAttribute("type", "content");
     this.setBrowserSize(980, 480);
     this.browser.style.width = gScreenWidth + "px";
     this.browser.style.height = gScreenHeight + "px";
-    this.browser.style.MozTransformOrigin = "0 0";
     this.vbox.appendChild(this.browser);
 
     this.browser.stop();
 
     let frameLoader = this.browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
     if (kUsingGLLayers) {
         frameLoader.renderMode = Ci.nsIFrameLoader.RENDER_MODE_ASYNC_SCROLL;
     } else {
@@ -1561,37 +1553,29 @@ Tab.prototype = {
     // and store it separately to the viewport.
     let excessX = aViewport.x - win.scrollX;
     let excessY = aViewport.y - win.scrollY;
 
     this._viewport.width = gScreenWidth = aViewport.width;
     this._viewport.height = gScreenHeight = aViewport.height;
     dump("### gScreenWidth = " + gScreenWidth + "\n");
 
-    let transformChanged = false;
-
     if ((aViewport.offsetX != this._viewport.offsetX) ||
         (excessX != this.viewportExcess.x)) {
       this._viewport.offsetX = aViewport.offsetX;
       this.viewportExcess.x = excessX;
-      transformChanged = true;
     }
     if ((aViewport.offsetY != this._viewport.offsetY) ||
         (excessY != this.viewportExcess.y)) {
       this._viewport.offsetY = aViewport.offsetY;
       this.viewportExcess.y = excessY;
-      transformChanged = true;
     }
     if (Math.abs(aViewport.zoom - this._viewport.zoom) >= 1e-6) {
       this._viewport.zoom = aViewport.zoom;
-      transformChanged = true;
     }
-
-    if (transformChanged)
-      this.updateTransform();
   },
 
   screenshot: function(aSrc, aDst) {
       // FIXME: Reenable
       //if (!this.browser || !this.browser.contentWindow)
         return;
 
       let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
@@ -1612,30 +1596,16 @@ Tab.prototype = {
         }
       };
       sendMessageToJava(message);
       Services.tm.mainThread.dispatch(function() {
 	  BrowserApp.doNextScreenshot()
       }, Ci.nsIThread.DISPATCH_NORMAL);
   },
 
-  updateTransform: function() {
-    let hasZoom = (Math.abs(this._viewport.zoom - 1.0) >= 1e-6);
-    let x = this._viewport.offsetX + Math.round(-this.viewportExcess.x * this._viewport.zoom);
-    let y = this._viewport.offsetY + Math.round(-this.viewportExcess.y * this._viewport.zoom);
-
-    let transform =
-      "translate(" + x + "px, " +
-                     y + "px)";
-
-    // FIXME: Use nsIDOMWindowUtils::SetResolution(this._viewport.zoom * k) for some k here.
-
-    this.browser.style.MozTransform = transform;
-  },
-
   get viewport() {
     // Update the viewport to current dimensions
     this._viewport.x = (this.browser.contentWindow.scrollX +
                         this.viewportExcess.x) || 0;
     this._viewport.y = (this.browser.contentWindow.scrollY +
                         this.viewportExcess.y) || 0;
 
     // Transform coordinates based on zoom