Bug 587248 - Part 10: Arrange tabs from right to left in RTL mode; r=ian a=blocking-betaN+
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 08 Nov 2010 01:38:25 -0500
changeset 57459 059ffd92444bb7a6192d879549faf2584371dacb
parent 57458 bca076d3a6a72c1e8e7481c6f995c6d4cc05875f
child 57460 e716f4ca4f7a0a184af64f62d132959cd57d5f9d
push id16934
push usereakhgari@mozilla.com
push dateSat, 13 Nov 2010 22:50:22 +0000
treeherdermozilla-central@674f2ed15cea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian, blocking-betaN
bugs587248
milestone2.0b8pre
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 587248 - Part 10: Arrange tabs from right to left in RTL mode; r=ian a=blocking-betaN+
browser/base/content/tabview/items.js
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -963,35 +963,40 @@ let Items = {
     if (rows == 1) {
       tabWidth = Math.min(tabWidth, (bounds.height - 2 * itemMargin) / tabAspect);
       tabHeight = tabWidth * tabAspect;
     }
     
     if (options.return == 'widthAndColumns')
       return {childWidth: tabWidth, columns: columns};
 
-    var box = new Rect(bounds.left, bounds.top, tabWidth, tabHeight);
+    let initialOffset = 0;
+    if (UI.rtl) {
+      initialOffset = bounds.width - tabWidth;
+    }
+    var box = new Rect(bounds.left + initialOffset, bounds.top, tabWidth, tabHeight);
+
     var column = 0;
 
     for (let a = 0; a < count; a++) {
       rects.push(new Rect(box));
       if (items && a < items.length) {
         let item = items[a];
         if (!item.locked.bounds) {
           item.setBounds(box, immediately);
           item.setRotation(0);
           if (options.z)
             item.setZ(options.z);
         }
       }
 
-      box.left += box.width + padding;
+      box.left += (UI.rtl ? -1 : 1) * (box.width + padding);
       column++;
       if (column == columns) {
-        box.left = bounds.left;
+        box.left = bounds.left + initialOffset;
         box.top += (box.height * yScale) + padding;
         column = 0;
       }
     }
 
     return rects;
   },