Bug 587248 - Part 11: Rotate the collapsed tab items towards top right in RTL mode; r=ian a=blocking-betaN+
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 08 Nov 2010 01:38:25 -0500
changeset 57460 e716f4ca4f7a0a184af64f62d132959cd57d5f9d
parent 57459 059ffd92444bb7a6192d879549faf2584371dacb
child 57461 3c140d56fd3e6a7038bbe0746696aaec89f72462
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersian, blocking-betaN
bugs587248
milestone2.0b8pre
Bug 587248 - Part 11: Rotate the collapsed tab items towards top right in RTL mode; r=ian a=blocking-betaN+
browser/base/content/tabview/groupitems.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -1083,23 +1083,26 @@ GroupItem.prototype = Utils.extend(new I
         // yDensity = (the distance of the bottom of the last tab to the top of the content area)
         // / (the total available content height)
         this.yDensity = (rects[rects.length - 1].bottom - bb.top) / (bb.height);
 
         // xDensity = (the distance from the left of the content area to the right of the rightmost
         // tab) / (the total available content width)
 
         // first, find the right of the rightmost tab! luckily, they're in order.
-        // TODO: does this change for rtl?
         var rightMostRight = 0;
-        for each (var rect in rects) {
-          if (rect.right > rightMostRight)
-            rightMostRight = rect.right;
-          else
-            break;
+        if (UI.rtl) {
+          rightMostRight = rects[0].right;
+        } else {
+          for each (var rect in rects) {
+            if (rect.right > rightMostRight)
+              rightMostRight = rect.right;
+            else
+              break;
+          }
         }
         this.xDensity = (rightMostRight - bb.left) / (bb.width);
 
         this._isStacked = false;
       } else
         this._stackArrange(bb, options);
     }
 
@@ -1174,17 +1177,17 @@ GroupItem.prototype = Utils.extend(new I
 
     children.forEach(function(child, index) {
       if (!child.locked.bounds) {
         child.setZ(zIndex);
         zIndex--;
 
         child.addClass("stacked");
         child.setBounds(box, !animate);
-        child.setRotation(self._randRotate(maxRotation, index));
+        child.setRotation((UI.rtl ? -1 : 1) * self._randRotate(maxRotation, index));
       }
     });
 
     self._isStacked = true;
   },
 
   // ----------
   // Function: _randRotate