Bug 587248 - Part 13: Correct the welcome box positioning on first run in RTL mode; r=ian a=blocking-betaN+
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 10 Nov 2010 22:48:43 -0500
changeset 57462 7310d5f75b7e363aecb8d11d5d6bc48cfbf74c42
parent 57461 3c140d56fd3e6a7038bbe0746696aaec89f72462
child 57463 cfcd17257d001d61806c1e8d4fd2000229742a24
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersian, blocking-betaN
bugs587248
milestone2.0b8pre
Bug 587248 - Part 13: Correct the welcome box positioning on first run in RTL mode; r=ian a=blocking-betaN+
browser/base/content/tabview/ui.js
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -257,26 +257,29 @@ let UI = {
   // and, if firstTime == true, add the welcome video/tab
   reset: function UI_reset(firstTime) {
     let padding = Trenches.defaultRadius;
     let welcomeWidth = 300;
     let pageBounds = Items.getPageBounds();
     pageBounds.inset(padding, padding);
 
     let $actions = iQ("#actions");
-    if ($actions)
+    if ($actions) {
       pageBounds.width -= $actions.width();
+      if (UI.rtl)
+        pageBounds.left += $actions.width() - padding;
+    }
 
     // ___ make a fresh groupItem
     let box = new Rect(pageBounds);
     box.width = Math.min(box.width * 0.667,
                          pageBounds.width - (welcomeWidth + padding));
     box.height = box.height * 0.667;
     if (UI.rtl) {
-      box.right = pageBounds.width + pageBounds.left;
+      box.left = pageBounds.left + welcomeWidth + 2 * padding;
     }
 
     GroupItems.groupItems.forEach(function(group) {
       group.close();
     });
     
     let options = {
       bounds: box,
@@ -296,17 +299,17 @@ let UI = {
       let url = gPrefBranch.getCharPref("welcome_url");
       let newTab = gBrowser.loadOneTab(url, {inBackground: true});
       let newTabItem = newTab.tabItem;
       let parent = newTabItem.parent;
       Utils.assert(parent, "should have a parent");
 
       newTabItem.parent.remove(newTabItem);
       let aspect = TabItems.tabHeight / TabItems.tabWidth;
-      let welcomeBounds = new Rect(box.right + padding, box.top,
+      let welcomeBounds = new Rect(UI.rtl ? pageBounds.left : box.right, box.top,
                                    welcomeWidth, welcomeWidth * aspect);
       newTabItem.setBounds(welcomeBounds, true);
       GroupItems.setActiveGroupItem(groupItem);
     }
   },
 
   // Function: blurAll
   // Blurs any currently focused element