Bug 1470074 - Check direction when changing the dock position. r=gl
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 24 Aug 2018 00:09:34 +0000
changeset 490926 024d4f5de3aa6810014d16a1ef21d5ab2e471cb3
parent 490925 3de1d6228039258820829c04fe0d1b91d96ad6db
child 490927 efb8bd6f806258589bff057e6f8b479ec6745e56
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1470074
milestone63.0a1
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 1470074 - Check direction when changing the dock position. r=gl We add the devtool's iframe and splitter and browser content into XUL element. If the environment is RTL, this element order is inverted. So this patch will add the condition of direction to decide this element order. Differential Revision: https://phabricator.services.mozilla.com/D4035
devtools/client/framework/toolbox-hosts.js
--- a/devtools/client/framework/toolbox-hosts.js
+++ b/devtools/client/framework/toolbox-hosts.js
@@ -148,17 +148,23 @@ class SidebarHost {
     this.frame.flex = 1; // Required to be able to shrink when the window shrinks
     this.frame.className = "devtools-toolbox-side-iframe";
 
     this.frame.width = Math.min(
       Services.prefs.getIntPref(this.widthPref),
       this._sidebar.clientWidth - MIN_PAGE_SIZE
     );
 
-    if (this.type == "right") {
+    // We should consider the direction when changing the dock position.
+    const topWindow = this.hostTab.ownerDocument.defaultView.top;
+    const topDoc = topWindow.document.documentElement;
+    const isLTR = topWindow.getComputedStyle(topDoc).direction === "ltr";
+
+    if (isLTR && this.type == "right" ||
+        !isLTR && this.type == "left") {
       this._sidebar.appendChild(this._splitter);
       this._sidebar.appendChild(this.frame);
     } else {
       this._sidebar.insertBefore(this.frame, this._browser);
       this._sidebar.insertBefore(this._splitter, this._browser);
     }
 
     this.frame.tooltip = "aHTMLTooltip";