merge
authorBenjamin Stover <bstover@mozilla.com>
Fri, 03 Sep 2010 10:01:35 -0700
changeset 1988 e57964f1a97f42b519b27c12967939f3258a8582
parent 1987 3dfec19150148589917e3572a56eb3a19f4b6f5d (current diff)
parent 1886 d5335811c209b64fd7d470b2908f17e489720bca (diff)
child 1989 efa6ca97ffd91610eac954babc854d3c4c36d3a5
push id1714
push userdougt@mozilla.com
push dateThu, 16 Sep 2010 02:04:21 +0000
merge
app/mobile.js
chrome/content/browser-ui.js
chrome/content/browser.js
chrome/content/browser.xul
chrome/content/content.js
chrome/content/tabs.xml
themes/core/browser.css
--- a/app/mobile.js
+++ b/app/mobile.js
@@ -95,17 +95,17 @@ pref("network.http.pipelining", true);
 pref("network.http.pipelining.ssl", true);
 pref("network.http.proxy.pipelining", true);
 pref("network.http.pipelining.maxrequests" , 6);
 pref("network.http.keep-alive.timeout", 600);
 pref("network.http.max-connections", 6);
 pref("network.http.max-connections-per-server", 4);
 pref("network.http.max-persistent-connections-per-server", 4);
 pref("network.http.max-persistent-connections-per-proxy", 4);
-#ifdef MOZ_ENABLE_LIBCONIC
+#ifdef MOZ_PLATFORM_MAEMO
 pref("network.autodial-helper.enabled", true);
 #endif
 
 /* history max results display */
 pref("browser.display.history.maxresults", 100);
 
 /* session history */
 pref("browser.sessionhistory.max_total_viewers", 1);
--- a/chrome/content/Util.js
+++ b/chrome/content/Util.js
@@ -34,26 +34,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-let Ci = Components.interfaces;
-
-// Blindly copied from Safari documentation for now.
-const kViewportMinScale  = 0;
-const kViewportMaxScale  = 10;
-const kViewportMinWidth  = 200;
-const kViewportMaxWidth  = 10000;
-const kViewportMinHeight = 223;
-const kViewportMaxHeight = 10000;
-
 // -----------------------------------------------------------
 // General util/convenience tools
 //
 
 Cu.import("resource://gre/modules/Geometry.jsm");
 
 let Util = {
   bind: function bind(f, thisObj) {
@@ -66,40 +56,41 @@ let Util = {
     let bind = Util.bind;
     for (let key in instance)
       if (instance[key] instanceof Function)
         instance[key] = bind(instance[key], instance);
   },
 
   /** printf-like dump function */
   dumpf: function dumpf(str) {
-    var args = arguments;
-    var i = 1;
+    let args = arguments;
+    let i = 1;
     dump(str.replace(/%s/g, function() {
       if (i >= args.length) {
         throw "dumps received too many placeholders and not enough arguments";
       }
       return args[i++].toString();
     }));
   },
 
   /** Like dump, but each arg is handled and there's an automatic newline */
   dumpLn: function dumpLn() {
-    for (var i = 0; i < arguments.length; i++) { dump(arguments[i] + " "); }
+    for (let i = 0; i < arguments.length; i++)
+      dump(arguments[i] + " ");
     dump("\n");
   },
 
   getWindowUtils: function getWindowUtils(aWindow) {
     return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
   },
 
   getScrollOffset: function getScrollOffset(aWindow) {
-    var cwu = Util.getWindowUtils(aWindow);
-    var scrollX = {};
-    var scrollY = {};
+    let cwu = Util.getWindowUtils(aWindow);
+    let scrollX = {};
+    let scrollY = {};
     cwu.getScrollXY(false, scrollX, scrollY);
     return new Point(scrollX.value, scrollY.value);
   },
 
   /** Executes aFunc after other events have been processed. */
   executeSoon: function executeSoon(aFunc) {
     Services.tm.mainThread.dispatch({
       run: function() {
@@ -203,26 +194,21 @@ let Util = {
     }
 
     return resultSoFar;
   },
 
   // Put the Mozilla networking code into a state that will kick the auto-connection
   // process.
   forceOnline: function forceOnline() {
-#ifdef MOZ_ENABLE_LIBCONIC
+#ifdef MOZ_PLATFORM_MAEMO
     Services.io.offline = false;
 #endif
   },
 
-  /** Capitalize first letter of a string. */
-  capitalize: function(str) {
-    return str.charAt(0).toUpperCase() + str.substring(1);
-  },
-  
   isPortrait: function isPortrait() {
     return (window.innerWidth < 500);
   }
 };
 
 
 /**
  * Helper class to nsITimer that adds a little more pizazz.  Callback can be an
@@ -285,33 +271,8 @@ Util.Timeout.prototype = {
   },
 
   /** Return true iff we are waiting for a callback. */
   isPending: function isPending() {
     return !!this._type;
   }
 };
 
-
-
-/**
- * Cache of commonly used elements.
- */
-let Elements = {};
-
-[
-  ["browserBundle",      "bundle_browser"],
-  ["contentShowing",     "bcast_contentShowing"],
-  ["urlbarState",        "bcast_urlbarState"],
-  ["stack",              "stack"],
-  ["panelUI",            "panel-container"],
-  ["viewBuffer",         "view-buffer"],
-  ["toolbarContainer",   "toolbar-container"],
-].forEach(function (elementGlobal) {
-  let [name, id] = elementGlobal;
-  Elements.__defineGetter__(name, function () {
-    let element = document.getElementById(id);
-    if (!element)
-      return null;
-    delete Elements[name];
-    return Elements[name] = element;
-  });
-});
--- a/chrome/content/browser-ui.js
+++ b/chrome/content/browser-ui.js
@@ -44,51 +44,60 @@ XPCOMUtils.defineLazyGetter(this, "Plura
   return PluralForm;
 });
 
 XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
   Cu.import("resource://gre/modules/PlacesUtils.jsm");
   return PlacesUtils;
 });
 
-const TOOLBARSTATE_LOADING  = 1;
-const TOOLBARSTATE_LOADED   = 2;
+XPCOMUtils.defineLazyServiceGetter(window, "gHistSvc", "@mozilla.org/browser/nav-history-service;1", "nsINavHistoryService", "nsIBrowserHistory");
+XPCOMUtils.defineLazyServiceGetter(window, "gURIFixup", "@mozilla.org/docshell/urifixup;1", "nsIURIFixup");
+XPCOMUtils.defineLazyServiceGetter(window, "gFaviconService", "@mozilla.org/browser/favicon-service;1", "nsIFaviconService");
+XPCOMUtils.defineLazyServiceGetter(window, "gFocusManager", "@mozilla.org/focus-manager;1", "nsIFocusManager");
 
 [
-  [
-    "gHistSvc",
-    "@mozilla.org/browser/nav-history-service;1",
-    [Ci.nsINavHistoryService, Ci.nsIBrowserHistory]
-  ],
-  [
-    "gFaviconService",
-     "@mozilla.org/browser/favicon-service;1",
-     [Ci.nsIFaviconService]
-  ],
-  [
-    "gURIFixup",
-    "@mozilla.org/docshell/urifixup;1",
-    [Ci.nsIURIFixup]
-  ],
-  [
-    "gFocusManager",
-    "@mozilla.org/focus-manager;1",
-    [Ci.nsIFocusManager]
-  ]
-].forEach(function (service) {
-  let [name, contract, ifaces] = service;
-  window.__defineGetter__(name, function () {
-    delete window[name];
-    window[name] = Cc[contract].getService(ifaces.splice(0, 1)[0]);
-    if (ifaces.length)
-      ifaces.forEach(function (i) { return window[name].QueryInterface(i); });
-    return window[name];
+  ["AllPagesList", "popup_autocomplete", "cmd_openLocation"],
+  ["HistoryList", "history-items", "cmd_history"],
+  ["BookmarkList", "bookmarks-items", "cmd_bookmarks"],
+#ifdef MOZ_SERVICES_SYNC
+  ["RemoteTabsList", "remotetabs-items", "cmd_remoteTabs"]
+#endif
+].forEach(function(aPanel) {
+  let [name, id, command] = aPanel;
+  XPCOMUtils.defineLazyGetter(window, name, function() {
+    return new AwesomePanel(id, command);
   });
 });
 
+/**
+ * Cache of commonly used elements.
+ */
+let Elements = {};
+
+[
+  ["browserBundle",      "bundle_browser"],
+  ["contentShowing",     "bcast_contentShowing"],
+  ["urlbarState",        "bcast_urlbarState"],
+  ["stack",              "stack"],
+  ["tabs",               "tabs-container"],
+  ["controls",           "browser-controls"],
+  ["panelUI",            "panel-container"],
+  ["viewBuffer",         "view-buffer"],
+  ["toolbarContainer",   "toolbar-container"],
+].forEach(function (aElementGlobal) {
+  let [name, id] = aElementGlobal;
+  XPCOMUtils.defineLazyGetter(Elements, name, function() {
+    return document.getElementById(id);
+  });
+});
+
+const TOOLBARSTATE_LOADING  = 1;
+const TOOLBARSTATE_LOADED   = 2;
+
 var BrowserUI = {
   _edit : null,
   _throbber : null,
   _favicon : null,
   _dialogs: [],
 
   _domWillOpenModalDialog: function(aBrowser) {
     // We're about to open a modal dialog, make sure the opening
@@ -345,21 +354,18 @@ var BrowserUI = {
     if (!this._toolbarH) {
       let toolbar = document.getElementById("toolbar-main");
       this._toolbarH = toolbar.boxObject.height;
     }
     return this._toolbarH;
   },
 
   get sidebarW() {
-    if (!this._sidebarW) {
-      let sidebar = document.getElementById("browser-controls");
-      this._sidebarW = sidebar.boxObject.width;
-    }
-    return this._sidebarW;
+    delete this._sidebarW;
+    return this._sidebarW = Elements.controls.getBoundingClientRect().width;
   },
 
   get starButton() {
     delete this.starButton;
     return this.starButton = document.getElementById("tool-star");
   },
 
   sizeControls: function(windowW, windowH) {
@@ -1274,17 +1280,27 @@ var PageActions = {
 };
 
 var NewTabPopup = {
   _timeout: 0,
   _tabs: [],
 
   get box() {
     delete this.box;
-    return this.box = document.getElementById("newtab-popup");
+    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;
   },
 
   _updateLabel: function() {
     let newtabStrings = Elements.browserBundle.getString("newtabpopup.opened");
     let label = PluralForm.get(this._tabs.length, newtabStrings).replace("#1", this._tabs.length);
 
     this.box.firstChild.setAttribute("value", label);
   },
@@ -1364,46 +1380,47 @@ var AwesomePanel = function(aElementId, 
       BrowserUI.activePanel = null;
       BrowserUI.goToURI(uri);
     }
   }
 };
 
 var BookmarkPopup = {
   get box() {
+    delete this.box;
+    this.box = document.getElementById("bookmark-popup");
+
+    const margin = 10;
+    let [tabsSidebar, controlsSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
+    this.box.setAttribute(tabsSidebar.left < controlsSidebar.left ? "right" : "left", controlsSidebar.width + margin);
+    this.box.top  = BrowserUI.starButton.getBoundingClientRect().top + margin;
+
+    // Hide the popup if there is any new page loading
     let self = this;
-    // Hide the popup if there is any new page loading
     messageManager.addMessageListener("pagehide", function(aMessage) {
       self.hide();
     });
 
-    delete this.box;
-    return this.box = document.getElementById("bookmark-popup");
+    return this.box;
   },
 
   _bookmarkPopupTimeout: -1,
 
   hide : function hide() {
     if (this._bookmarkPopupTimeout != -1) {
       clearTimeout(this._bookmarkPopupTimeout);
       this._bookmarkPopupTimeout = -1;
     }
     this.box.hidden = true;
     BrowserUI.popPopup();
   },
 
   show : function show(aAutoClose) {
-    const margin = 10;
-
     this.box.hidden = false;
 
-    let [,,,controlsW] = Browser.computeSidebarVisibility();
-    this.box.left = window.innerWidth - (this.box.getBoundingClientRect().width + controlsW + margin);
-    this.box.top  = BrowserUI.starButton.getBoundingClientRect().top + margin;
-
     if (aAutoClose) {
       this._bookmarkPopupTimeout = setTimeout(function (self) {
         self._bookmarkPopupTimeout = -1;
         self.hide();
       }, 2000, this);
     }
 
     // include starButton here, so that click-to-dismiss works as expected
@@ -2455,27 +2472,8 @@ var SharingUI = {
       callback: function callback(aURL, aTitle) {
         let url = "http://www.facebook.com/share.php?u=" + encodeURIComponent(aURL);
         Browser.addTab(url, true, Browser.selectedTab);
       }
     }
   ]
 };
 
-
-XPCOMUtils.defineLazyGetter(this, "HistoryList", function() {
-  return new AwesomePanel("history-items", "cmd_history");
-});
-
-#ifdef MOZ_SERVICES_SYNC
-XPCOMUtils.defineLazyGetter(this, "RemoteTabsList", function() {
-  return new AwesomePanel("remotetabs-items", "cmd_remoteTabs");
-});
-#endif
-
-XPCOMUtils.defineLazyGetter(this, "AllPagesList", function() {
-  return new AwesomePanel("popup_autocomplete", "cmd_openLocation");
-});
-
-XPCOMUtils.defineLazyGetter(this, "BookmarkList", function() {
-  return new AwesomePanel("bookmarks-items", "cmd_bookmarks");
-});
-
--- a/chrome/content/browser.js
+++ b/chrome/content/browser.js
@@ -744,45 +744,42 @@ var Browser = {
   },
 
   /**
    * Compute the sidebar percentage visibility.
    *
    * @param [optional] dx
    * @param [optional] dy an offset distance at which to perform the visibility
    * computation
-   * @return [leftVisibility, rightVisiblity, leftTotalWidth, rightTotalWidth]
    */
   computeSidebarVisibility: function computeSidebarVisibility(dx, dy) {
-    function visibility(bar, visrect) {
-      let w = bar.width;
-      bar.restrictTo(visrect);
-      return bar.width / w;
+    function visibility(aSidebarRect, aVisibleRect) {
+      let width = aSidebarRect.width;
+      aSidebarRect.restrictTo(aVisibleRect);
+      return aSidebarRect.width / width;
     }
 
     if (!dx) dx = 0;
     if (!dy) dy = 0;
 
-    let leftbarCBR = document.getElementById('tabs-container').getBoundingClientRect();
-    let ritebarCBR = document.getElementById('browser-controls').getBoundingClientRect();
+    let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
+    if (leftSidebar.left > rightSidebar.left)
+      [rightSidebar, leftSidebar] = [leftSidebar, rightSidebar]; // switch in RTL case
 
-    if (leftbarCBR.left > ritebarCBR.left)
-      [ritebarCBR, leftbarCBR] = [leftbarCBR, ritebarCBR]; // switch in RTL case
+    let visibleRect = new Rect(0, 0, window.innerWidth, 1);
+    let leftRect = new Rect(Math.round(leftSidebar.left) - Math.round(dx), 0, Math.round(leftSidebar.width), 1);
+    let rightRect = new Rect(Math.round(rightSidebar.left) - Math.round(dx), 0, Math.round(rightSidebar.width), 1);
 
-    let leftbar = new Rect(Math.round(leftbarCBR.left) - Math.round(dx), 0, Math.round(leftbarCBR.width), 1);
-    let ritebar = new Rect(Math.round(ritebarCBR.left) - Math.round(dx), 0, Math.round(ritebarCBR.width), 1);
-    let leftw = leftbar.width;
-    let ritew = ritebar.width;
+    let leftTotalWidth = leftRect.width;
+    let leftVisibility = visibility(leftRect, visibleRect);
 
-    let visrect = new Rect(0, 0, window.innerWidth, 1);
+    let rightTotalWidth = rightRect.width;
+    let rightVisibility = visibility(rightRect, visibleRect);
 
-    let leftvis = visibility(leftbar, visrect);
-    let ritevis = visibility(ritebar, visrect);
-
-    return [leftvis, ritevis, leftw, ritew];
+    return [leftVisibility, rightVisibility, leftTotalWidth, rightTotalWidth];
   },
 
   /**
    * Compute the horizontal distance needed to scroll in order to snap the
    * sidebars into place.
    *
    * Visibility is computed by creating dummy rectangles for the sidebar and the
    * visible rect.  Sidebar rectangles come from getBoundingClientRect(), so
@@ -1895,26 +1892,33 @@ function showDownloadManager(aWindowCont
   // TODO: select the download with aID
 }
 
 var AlertsHelper = {
   _timeoutID: -1,
   _listener: null,
   _cookie: "",
   _clickable: false,
-  _container: null,
   get container() {
-    if (!this._container) {
-      this._container = document.getElementById("alerts-container");
-      let self = this;
-      this._container.addEventListener("transitionend", function() {
-        self.alertTransitionOver();
-      }, true);
+    delete this.container;
+    let container = document.getElementById("alerts-container");
+
+    // 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) {
+      container.removeAttribute("right");
+      container.setAttribute("left", "0");
     }
-    return this._container;
+
+    let self = this;
+    container.addEventListener("transitionend", function() {
+      self.alertTransitionOver();
+    }, true);
+
+    return this.container = container;
   },
 
   showAlertNotification: function ah_show(aImageURL, aTitle, aText, aTextClickable, aCookie, aListener) {
     this._clickable = aTextClickable || false;
     this._listener = aListener || null;
     this._cookie = aCookie || "";
 
     document.getElementById("alerts-image").setAttribute("src", aImageURL);
--- a/chrome/content/browser.xul
+++ b/chrome/content/browser.xul
@@ -347,17 +347,17 @@
         <pageaction id="pageaction-search" title="&pageactions.search.addNew;"/>
       </hbox>
     </vbox>
 
     <vbox id="newtab-popup" hidden="true" class="dialog-dark" onclick="NewTabPopup.selectTab()" align="center" left="21">
       <label/>
     </vbox>
 
-    <vbox id="bookmark-popup" hidden="true" class="dialog-dark" align="center" left="0">
+    <vbox id="bookmark-popup" hidden="true" class="dialog-dark" align="center">
       <label value="&bookmarkPopup.label;"/>
       <separator class="thin"/>
       <vbox>
         <button id="bookmark-popup-edit" label="&bookmarkEdit.label;" class="button-dark" oncommand="BookmarkHelper.edit();"/>
         <spacer/>
         <button id="bookmark-popup-remove" label="&bookmarkRemove.label;" class="button-dark" oncommand="BookmarkPopup.hide(); BookmarkHelper.removeBookmarksForURI(getBrowser().currentURI);"/>
       </vbox>
     </vbox>
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -13,16 +13,23 @@ Cu.import("resource://gre/modules/Servic
 let gFocusManager = Cc["@mozilla.org/focus-manager;1"]
   .getService(Ci.nsIFocusManager);
 
 let XULDocument = Ci.nsIDOMXULDocument;
 let HTMLHtmlElement = Ci.nsIDOMHTMLHtmlElement;
 let HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement;
 let HTMLFrameElement = Ci.nsIDOMHTMLFrameElement;
 
+// Blindly copied from Safari documentation for now.
+const kViewportMinScale  = 0;
+const kViewportMaxScale  = 10;
+const kViewportMinWidth  = 200;
+const kViewportMaxWidth  = 10000;
+const kViewportMinHeight = 223;
+const kViewportMaxHeight = 10000;
 
 /** Watches for mouse click in content and redirect them to the best found target **/
 const ElementTouchHelper = {
   get radius() {
     let prefs = Services.prefs;
     delete this.radius;
     return this.radius = { "top": prefs.getIntPref("browser.ui.touch.top"),
                            "right": prefs.getIntPref("browser.ui.touch.right"),
--- a/chrome/content/downloads.js
+++ b/chrome/content/downloads.js
@@ -419,33 +419,28 @@ var DownloadsView = {
       // We only show alerts if the download view is not visible
       if (this.visible)
         return;
 
       let download = aSubject.QueryInterface(Ci.nsIDownload);
       let strings = Elements.browserBundle;
       var notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
 
-      if (aTopic == "dl-start") {
-        notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD, strings.getString("alertDownloads"),
-                                       strings.getFormattedString("alertDownloadsStart", [download.displayName]), false, "", null,
-                                       download.target.spec.replace("file:", "download:"));
-      }
-      else {
-        let observer = {
-          observe: function (aSubject, aTopic, aData) {
-            if (aTopic == "alertclickcallback")
-              BrowserUI.showPanel("downloads-container");
-          }
-        };
+      // Callback for tapping on the alert popup
+      let observer = {
+        observe: function (aSubject, aTopic, aData) {
+          if (aTopic == "alertclickcallback")
+            BrowserUI.showPanel("downloads-container");
+        }
+      };
 
-        notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD, strings.getString("alertDownloads"),
-                                       strings.getFormattedString("alertDownloadsDone", [download.displayName]), true, "", observer,
-                                       download.target.spec.replace("file:", "download:"));
-      }
+      let msgKey = aTopic == "dl-start" ? "alertDownloadsStart" : "alertDownloadsDone";
+      notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD, strings.getString("alertDownloads"),
+                                     strings.getFormattedString(msgKey, [download.displayName]), true, "", observer,
+                                     download.target.spec.replace("file:", "download:"));
     }
   },
 
   QueryInterface: function (aIID) {
     if (!aIID.equals(Ci.nsIObserver) &&
         !aIID.equals(Ci.nsISupportsWeakReference) &&
         !aIID.equals(Ci.nsISupports))
       throw Components.results.NS_ERROR_NO_INTERFACE;
--- a/chrome/content/tabs.xml
+++ b/chrome/content/tabs.xml
@@ -4,19 +4,19 @@
     xmlns="http://www.mozilla.org/xbl"
     xmlns:xbl="http://www.mozilla.org/xbl"
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <binding id="documenttab">
     <content>
       <xul:stack anonid="page" class="documenttab-container" flex="1">
-        <html:canvas anonid="canvas" class="documenttab-canvas" left="8" width="106" height="64" moz-opaque="true"
+        <html:canvas anonid="canvas" class="documenttab-canvas" left="0" width="106" height="64" moz-opaque="true"
           onclick="document.getBindingParent(this)._onClick()" xbl:inherits="selected"/>
-        <xul:hbox left="0" top="10" height="64" width="55" align="center" onclick="document.getBindingParent(this)._close()">
+        <xul:hbox class="documenttab-close-container" left="0" top="10" height="64" width="55" align="center" onclick="document.getBindingParent(this)._close()">
           <xul:image anonid="close" class="documenttab-close" mousethrough="always"/>
         </xul:hbox>
       </xul:stack>
     </content>
     
    <implementation>
       <method name="_onClick">
         <body>
--- a/themes/core/browser.css
+++ b/themes/core/browser.css
@@ -870,17 +870,17 @@ autocompleteresult.noresults > .autocomp
   }
 
   #awesome-header > toolbarbutton .toolbarbutton-text {
     font-size: 18px !important;
   }
 }
 
 #awesome-header > toolbarbutton:last-child {
-  border-right-width: 0;
+  -moz-border-end-width: 0;
 }
 
 #awesome-header > toolbarbutton:hover:active,
 #awesome-header > toolbarbutton[checked="true"] {
   border-color: #36373b !important;
   color: white !important;
   background: -moz-radial-gradient(#757575, #636363, #666769) !important;
 }
@@ -902,27 +902,32 @@ autocompleteresult.noresults > .autocomp
   min-width: 48px;
   min-height: 48px;
 }
 
 #awesome-header > toolbarbutton .toolbarbutton-text {
   text-align: left;
 }
 
+#awesome-header > toolbarbutton .toolbarbutton-text:-moz-locale-dir(rtl) {
+  text-align: right;
+}
+
 #awesome-header > toolbarbutton.choice-bookmarks {
   list-style-image: url(chrome://browser/skin/images/bookmarks-48.png);
 }
 
 #awesome-header > toolbarbutton.choice-history {
   list-style-image: url(chrome://browser/skin/images/history-48.png);
 }
 
 #awesome-header > toolbarbutton.choice-remotetabs {
   list-style-image: url(chrome://browser/skin/images/remotetabs-48.png);
 }
+
 #awesome-header > toolbarbutton:hover:active,
 #awesome-header > toolbarbutton[checked="true"] {
   border-color: #36373b !important;
   color: white !important;
   background: -moz-radial-gradient(#757575, #636363, #666769) !important;
 }
 
 #awesome-header > toolbarbutton[checked="true"],
@@ -981,16 +986,17 @@ autocompleteresult.noresults > .autocomp
   margin-top: 8px; /* core spacing */
   -moz-box-pack: start;
 }
 
 box[type="documenttab"] {
   /* display:block allow us to change the line-height, it won't work otherwise */
   display: block;
   width: 128px;
+  -moz-margin-start: 8px; /* core spacing */
   line-height: 0;
 }
 
 .documenttab-canvas {
   /* keep the unselected thumbnails aligned with the selected one */
   border: 8px solid #36373b;
   background-color: white;
 }
@@ -999,16 +1005,20 @@ box[type="documenttab"] {
   border: 8px solid;
   -moz-border-radius: 3px;
   -moz-border-top-colors: #8db8d8 #8db8d8 #8db8d8 #8db8d8 #36373b;
   -moz-border-right-colors: #8db8d8 #8db8d8 #8db8d8 #8db8d8 #36373b;
   -moz-border-bottom-colors: #8db8d8 #8db8d8 #8db8d8 #8db8d8 #36373b;
   -moz-border-left-colors: #8db8d8 #8db8d8 #8db8d8 #8db8d8 #36373b;
 }
 
+.documenttab-close-container {
+  -moz-margin-end: 65px;
+}
+
 .documenttab-close {
   width: 40px;
   height: 40px;
   list-style-image: url("chrome://browser/skin/images/close-default-40.png");
 }
 
 hbox:hover:active > .documenttab-close {
   list-style-image: url("chrome://browser/skin/images/close-active-40.png");
@@ -1190,16 +1200,26 @@ pageaction {
     width: 100%;
   }
 
   .prompt-button:last-child:not(:nth-child(odd)),
   pageaction[selector="last-child"][even=true] {
     border-bottom: 1px solid #fff;
     -moz-border-radius-bottomright: 8px;
   }
+
+  .prompt-button:nth-last-child(2):not(:nth-child(even)):-moz-locale-dir(rtl) {
+    -moz-border-radius-bottomleft: 0;
+    -moz-border-radius-bottomright: 8px;
+  }
+
+  .prompt-button:last-child:not(:nth-child(odd)):-moz-locale-dir(rtl) {
+    -moz-border-radius-bottomright: 0;
+    -moz-border-radius-bottomleft: 8px;
+  }
 }
 
 @media (max-width: 499px) {
   .prompt-button:last-child,
   pageaction[selector="last-child"] {
     -moz-border-radius-bottomleft: 8px;
     -moz-border-radius-bottomright: 8px;
   }
@@ -1210,18 +1230,18 @@ pageaction[selector="last-child"] {
   background-image: -moz-linear-gradient(top, rgb(235,235,235) 0%, rgb(215,215,215) 90%);
 }
 
 .prompt-button:first-child,
 pageaction[selector="first-child"] {
   background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(235,235,235) 90%);
 }
 
-.prompt-button:hover:active,
-pageaction:hover:active {
+.prompt-button:not([disabled]):hover:active,
+pageaction:not([disabled]):hover:active {
   background-image: none !important;
   background-color: #8db8d8 !important;
 }
 
 pageaction > hbox > .pageaction-image {
   width: 32px;
   height: 32px;
   -moz-margin-end: 8px;
@@ -1302,16 +1322,20 @@ pageaction:hover:active > vbox > .pageac
 #alerts-container {
   -moz-transform: translatex(100%);
   -moz-transition-property: -moz-transform;
   -moz-transition-duration: 0.5s;
   margin-bottom: 20px;
   -moz-margin-end: 20px;
 }
 
+#alerts-container:-moz-locale-dir(rtl) {
+  -moz-transform: translatex(-100%);
+}
+
 #alerts-container.showing {
   -moz-transform: translatex(0);
 }
 
 #alerts-text {
   font-size: 18px !important;
   white-space: pre-wrap;
 }