Bug 701351 - Back out 0aeaa4995892 (XUL scrollbars) [r=mfinkle]
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 21 Nov 2011 18:15:29 -0500
changeset 83568 d099c3df68661a09ba14c357d57877aebae0ce7f
parent 83567 dac80a8d25d44e329bfa1138727260a3774a07b8
child 83569 77e488af39ff4ef5c00e0ba0f32f65d2c0079d56
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs701351, 695569
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 701351 - Back out 0aeaa4995892 (XUL scrollbars) [r=mfinkle] This removes the XUL scrollbars introduced in bug 695569, as they no longer work with the layers code.
mobile/android/chrome/content/browser.js
mobile/android/chrome/content/browser.xul
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -133,26 +133,22 @@ var Strings = {};
   });
 });
 
 var BrowserApp = {
   _tabs: [],
   _selectedTab: null,
 
   deck: null,
-  vertScroller: null,
-  horizScroller: null,
 
   startup: function startup() {
     window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
     dump("zerdatime " + Date.now() + " - browser chrome startup finished.");
 
     this.deck = document.getElementById("browsers");
-    this.vertScroller = document.getElementById("vertical-scroller");
-    this.horizScroller = document.getElementById("horizontal-scroller");
     BrowserEventHandler.init();
 
     getBridge().setDrawMetadataProvider(this.getDrawMetadata.bind(this));
 
     Services.obs.addObserver(this, "Tab:Add", false);
     Services.obs.addObserver(this, "Tab:Load", false);
     Services.obs.addObserver(this, "Tab:Select", false);
     Services.obs.addObserver(this, "Tab:Close", false);
@@ -537,56 +533,16 @@ var BrowserApp = {
     let doc = aBrowser.contentDocument;
     if (!doc)
       return;
     let focused = doc.activeElement;
     if ((focused instanceof HTMLInputElement && focused.mozIsTextField(false)) || (focused instanceof HTMLTextAreaElement))
       focused.scrollIntoView(false);
   },
 
-  updateScrollbarsFor: function(aElement) {
-    // only draw the scrollbars if we're scrolling the root content element
-    let doc = this.selectedBrowser.contentDocument;
-    if (aElement != doc.documentElement && aElement != doc.body)
-      return;
-
-    // draw the vertical scrollbar as needed
-    let scrollMax = aElement.scrollHeight;
-    let viewSize = aElement.clientHeight;
-    if (scrollMax > viewSize) {
-      let scrollPos = aElement.scrollTop;
-      let scrollerSize = this.selectedBrowser.clientHeight;
-      // scrollerSize may not equal viewSize if the user has zoomed
-      let barStart = Math.round(scrollerSize * scrollPos / scrollMax);
-      let barEnd = Math.round(scrollerSize * (scrollPos + viewSize) / scrollMax);
-      this.vertScroller.height = (barEnd - barStart);
-      this.vertScroller.style.MozTransform = "translateY(" + barStart + "px)";
-      this.vertScroller.setAttribute("panning", "true");
-    }
-
-    // draw the horizontal scrollbar as needed
-    scrollMax = aElement.scrollWidth;
-    viewSize = aElement.clientWidth;
-    if (scrollMax > viewSize) {
-      let scrollPos = aElement.scrollLeft;
-      let scrollerSize = this.selectedBrowser.clientWidth;
-      // scrollerSize may not equal viewSize if the user has zoomed
-      let barStart = Math.round(scrollerSize * scrollPos / scrollMax);
-      let barEnd = Math.round(scrollerSize * (scrollPos + viewSize) / scrollMax);
-      this.horizScroller.width = (barEnd - barStart);
-      this.horizScroller.style.MozTransform = "translateX(" + barStart + "px)";
-      this.horizScroller.setAttribute("panning", "true");
-    }
-  },
-
-  hideScrollbars: function() {
-    this.vertScroller.setAttribute("panning", "");
-    this.horizScroller.setAttribute("panning", "");
-  },
-
   getDrawMetadata: function getDrawMetadata() {
     return JSON.stringify(this.selectedTab.viewportMetrics);
   },
 
   setViewport: function setViewport(aNewViewport) {
     this.selectedTab.viewportMetrics = aNewViewport;
 
     /* TODO: Translate at edges. */
@@ -1384,21 +1340,16 @@ var BrowserEventHandler = {
             this.edy = 0;
           }
         }
         break;
 
       case "mouseup":
         this.panning = false;
 
-        // hide the scrollbars in case we're done scrolling. if the
-        // kinetic scrolling kicks in, it will re-enable the scrollbars
-        // anyway by calling _scrollElementBy below
-        BrowserApp.hideScrollbars();
-
         if (Math.abs(aEvent.clientX - this.startX) > kDragThreshold ||
             Math.abs(aEvent.clientY - this.startY) > kDragThreshold) {
           this.blockClick = true;
           aEvent.stopPropagation();
           aEvent.preventDefault();
 
           // Calculate a regression line for the last few motion events in
           // the same direction to estimate the velocity. This ought to do a
@@ -1544,27 +1495,24 @@ var BrowserEventHandler = {
 
               if (Math.abs(self.panAccumulatedDeltaY) >= 1.0) {
                   let ady = Math.floor(self.panAccumulatedDeltaY);
                   dy += ady;
                   self.panAccumulatedDeltaY -= ady;
               }
 
               if (!self._elementCanScroll(panElement, -dx, -dy)) {
-                BrowserApp.hideScrollbars();
                 return;
               }
 
               self._scrollElementBy(panElement, -dx, -dy);
 
               if (Math.abs(self.panX) >= kMinKineticSpeed ||
                   Math.abs(self.panY) >= kMinKineticSpeed)
                 window.mozRequestAnimationFrame(this);
-              else
-                BrowserApp.hideScrollbars();
             }
           };
 
           // If one axis is moving a lot slower than the other, lock it.
           if (Math.abs(this.panX) < Math.abs(this.panY) / kAxisLockRatio)
             this.panX = 0;
           else if (Math.abs(this.panY) < Math.abs(this.panX) / kAxisLockRatio)
             this.panY = 0;
@@ -1672,17 +1620,16 @@ var BrowserEventHandler = {
     return aElement instanceof Element &&
         (kElementsReceivingInput.hasOwnProperty(aElement.tagName.toLowerCase()) ||
         aElement.contentEditable === "true" || aElement.contentEditable === "");
   },
 
   _scrollElementBy: function(elem, x, y) {
     elem.scrollTop = elem.scrollTop + y;
     elem.scrollLeft = elem.scrollLeft + x;
-    BrowserApp.updateScrollbarsFor(elem);
   },
 
   _elementCanScroll: function(elem, x, y) {
     let scrollX = true;
     let scrollY = true;
 
     if (x < 0) {
       if (elem.scrollLeft <= 0) {
--- a/mobile/android/chrome/content/browser.xul
+++ b/mobile/android/chrome/content/browser.xul
@@ -1,21 +1,15 @@
 <?xml version="1.0"?>
 
-<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
-
 <window id="main-window"
         onload="BrowserApp.startup();"
         windowtype="navigator:browser"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript" src="chrome://browser/content/browser.js"/>
   <script type="application/javascript" src="chrome://browser/content/downloads.js"/>
   <script type="application/javascript" src="chrome://browser/content/exceptions.js"/>
   <script type="application/javascript" src="chrome://browser/content/sanitize.js"/>
 
-  <stack flex="1">
-    <deck id="browsers" flex="1"/>
-    <box id="vertical-scroller" class="scroller" orient="vertical" end="2" top="0"/>
-    <box id="horizontal-scroller" class="scroller" orient="horizontal" left="0" bottom="2"/>
-  </stack>
+  <deck id="browsers" flex="1"/>
 
 </window>