Bug 635522 - [rtl] tab close buttons in the wrong spot [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 01 Mar 2011 01:05:00 +0100
changeset 67441 2c75546245e03de23b8bce8a538c5a69a120feda
parent 67440 249f4e8fa68980bf89e8f60280a7d6172b5bdcbe
child 67442 73d6e1f708e9a1c9785d56963c3bfc3b9698e748
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)
reviewersmfinkle
bugs635522
Bug 635522 - [rtl] tab close buttons in the wrong spot [r=mfinkle]
mobile/chrome/content/browser.js
mobile/chrome/content/browser.xul
mobile/chrome/content/common-ui.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1253,22 +1253,27 @@ Browser.MainDragger.prototype = {
     let scaleX = this._scrollScales.x, scaleY = this._scrollScales.y;
     let contentScroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
     if (scaleX)
       this._horizontalScrollbar.style.MozTransform = "translateX(" + Math.round(contentScroll.x * scaleX) + "px)";
 
     if (scaleY) {
       let y = Math.round(contentScroll.y * scaleY);
 
-      // right scrollbar is out of view when showing the left sidebar,
+      // Vertical scrollbar is out of view when showing the tabs sidebar,
       // the 'solution' for now is to reposition it if needed
       let x = 0;
       if (Browser.floatedWhileDragging) {
-        let [leftVis,,leftW,] = Browser.computeSidebarVisibility();
-        x = Math.round(Math.max(0, leftW * leftVis));
+        // Check if the sidebars are inverted (rtl)
+        let [leftVis, rightVis, leftW, rightW] = Browser.computeSidebarVisibility();
+        let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
+        if (leftSidebar.left > rightSidebar.left)
+          x = Math.round(Math.max(0, rightW * rightVis));
+        else
+          x = Math.round(Math.max(0, leftW * leftVis));
       }
 
       this._verticalScrollbar.style.MozTransform = "translate(" + x + "px," + y + "px)";
     }
   },
 
   _showScrollbars: function _showScrollbars() {
     this._updateScrollbars();
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -268,17 +268,17 @@
             </box>
 
             <!-- Content viewport -->
             <vbox id="content-viewport" class="window-width window-height">
               <!-- Content viewport -->
               <stack>
                 <deck id="browsers" flex="1"/>
                 <!-- vertical scrollbar -->
-                <box id="vertical-scroller" class="scroller" orient="vertical" right="2" top="0"/>
+                <box id="vertical-scroller" class="scroller" orient="vertical" end="2" top="0"/>
               </stack>
             </vbox>
           </vbox>
         </scrollbox>
 
         <!-- popup for content navigator helper -->
         <vbox id="content-navigator" class="window-width" top="0">
           <textbox id="find-helper-textbox" class="search-bar content-navigator-item" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search"/>
@@ -572,17 +572,17 @@
       </vbox>
     </vbox>
 #endif
 
     <arrowbox id="search-engines-popup" hidden="true" offset="18" flex="1">
       <hbox id="search-engines-list" class="prompt-buttons" flex="1"/>
     </arrowbox>
 
-    <vbox id="newtab-popup" hidden="true" class="dialog-dark" onclick="NewTabPopup.selectTab()" align="center" left="21">
+    <vbox id="newtab-popup" hidden="true" class="dialog-dark" onclick="NewTabPopup.selectTab()" align="center" start="21">
       <label/>
     </vbox>
 
     <!-- options dialog for select form field -->
     <vbox id="select-container" class="window-width window-height context-block" top="0" left="0" hidden="true" flex="1">
       <vbox id="select-popup" class="dialog-dark">
         <hbox pack="center">
           <label id="select-title" class="options-title" align="center" crop="center" flex="1"/>
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -374,27 +374,17 @@ var NewTabPopup = {
   _tabs: [],
 
   init: function init() {
     Elements.tabs.addEventListener("TabOpen", this, true);
   },
 
   get box() {
     delete this.box;
-    let box = document.getElementById("newtab-popup");
-
-    // Move the popup on the other side if we are in RTL
-    let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
-    if (leftSidebar.left > rightSidebar.left) {
-      let margin = box.getAttribute("left");
-      box.removeAttribute("left");
-      box.setAttribute("right", margin);
-    }
-
-    return this.box = box;
+    return this.box = document.getElementById("newtab-popup");
   },
 
   _updateLabel: function nt_updateLabel() {
     let newtabStrings = Strings.browser.GetStringFromName("newtabpopup.opened");
     let label = PluralForm.get(this._tabs.length, newtabStrings).replace("#1", this._tabs.length);
 
     this.box.firstChild.setAttribute("value", label);
   },