Bug 593310 - show checkerboard for waiting-to-be-filled regions with browser elements as browsing surface (bitrot fix) [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Thu, 11 Nov 2010 15:43:41 -0500
changeset 66999 39b92049aa268776db1e91d65a2536771aaaf597
parent 66998 81c424a5ffb67db4ccd2045a6a47bd107ca01043
child 67000 970cfddedd461fe4ef63880f7cd361be826c3c0c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs593310
Bug 593310 - show checkerboard for waiting-to-be-filled regions with browser elements as browsing surface (bitrot fix) [r=mbrubeck]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -202,36 +202,37 @@ var Browser = {
 
     ContentTouchHandler.init();
 
     // Warning, total hack ahead. All of the real-browser related scrolling code
     // lies in a pretend scrollbox here. Let's not land this as-is. Maybe it's time
     // to redo all the dragging code.
     this.contentScrollbox = Elements.browsers;
     this.contentScrollboxScroller = {
-      scrollBy: function(dx, dy) {
-        getBrowser().scrollBy(dx, dy);
-
-        let scrollX = {}, scrollY = {};
-        getBrowser().getPosition(scrollX, scrollY);
-
-        let x = scrollX.value + dx;
-        let y = scrollY.value + dy;
-        document.getElementById("browsers").style.backgroundPosition = (-x % 128) + "px " + (-y % 128) + "px";
+      scrollBy: function(aDx, aDy) {
+        getBrowser().scrollBy(aDx, aDy);
+
+        let scroll = getBrowser().getPosition();
+        this._updateBackground(scroll.x, scroll.y);
+      },
+
+      scrollTo: function(aX, aY) {
+        getBrowser().scrollTo(aX, aY);
+        this._updateBackground(aX, aY);
       },
 
-      scrollTo: function(x, y) {
-        getBrowser().scrollTo(x, y);
-        document.getElementById("browsers").style.backgroundPosition = (-x % 128) + "px " + (-y % 128) + "px";
+      getPosition: function(aScrollX, aScrollY) {
+        let { x: x, y: y } = getBrowser().getPosition();
+        aScrollX.value = x;
+        aScrollY.value = y;
       },
 
-      getPosition: function(scrollX, scrollY) {
-        let { x: x, y: y } = getBrowser().getPosition();
-        scrollX.value = x;
-        scrollY.value = y;
+      _updateBackground: function _updateBackground(aX, aY) {
+        let position = (-aX % 128) + "px " + (-aY % 128) + "px";
+        document.getElementById("browsers").style.backgroundPosition = position;
       }
     };
 
     /* horizontally scrolling box that holds the sidebars as well as the contentScrollbox */
     let controlsScrollbox = this.controlsScrollbox = document.getElementById("controls-scrollbox");
     this.controlsScrollboxScroller = controlsScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
     controlsScrollbox.customDragger = {
       isDraggable: function isDraggable(target, content) { return {}; },