Bug 623485 - Use transforms to move scrollbars [r=vingtetun]
authorBenjamin Stover <ben@stechz.com>
Wed, 26 Jan 2011 15:56:38 +0100
changeset 67308 5bf4f772990ee2c9737b2a0c4de4c52f02f2cdc0
parent 67307 e869c03587f9e7eb0fe028509ffffd67c5b8b115
child 67309 78b41312ef10686b78430fdefa3d4d2a156faba6
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)
reviewersvingtetun
bugs623485
Bug 623485 - Use transforms to move scrollbars [r=vingtetun]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1287,31 +1287,30 @@ Browser.MainDragger.prototype = {
     let scroll1 = Browser.getScrollboxPosition(scroller);
     doffset.subtract(scroll1.x - scroll.x, scroll1.y - scroll.y);
   },
 
   _updateScrollbars: function _updateScrollbars() {
     let scaleX = this._scrollScales.x, scaleY = this._scrollScales.y;
     let contentScroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
     if (scaleX)
-      this._horizontalScrollbar.left = contentScroll.x * scaleX;
+      this._horizontalScrollbar.style.MozTransform = "translateX(" + Math.round(contentScroll.x * scaleX) + "px)";
 
     if (scaleY) {
-      const SCROLLER_MARGIN = 2;
-      this._verticalScrollbar.top = contentScroll.y * scaleY;
+      let y = Math.round(contentScroll.y * scaleY);
 
       // right scrollbar is out of view when showing the left sidebar,
       // the 'solution' for now is to reposition it if needed
+      let x = 0;
       if (Browser.floatedWhileDragging) {
         let [leftVis,,leftW,] = Browser.computeSidebarVisibility();
-        this._verticalScrollbar.setAttribute("right", Math.max(SCROLLER_MARGIN, leftW * leftVis + SCROLLER_MARGIN));
+        x = Math.round(Math.max(0, leftW * leftVis));
       }
-      else if (this._verticalScrollbar.getAttribute("right") != SCROLLER_MARGIN) {
-        this._verticalScrollbar.setAttribute("right", SCROLLER_MARGIN);
-      }
+
+      this._verticalScrollbar.style.MozTransform = "translate(" + x + "px," + y + "px)";
     }
   },
 
   _showScrollbars: function _showScrollbars() {
     let scaleX = this._scrollScales.x, scaleY = this._scrollScales.y;
     if (scaleX) {
       this._horizontalScrollbar.width = ViewableAreaObserver.width * scaleX;
       this._horizontalScrollbar.setAttribute("panning", "true");