Bug 1451690 - Use SplitBox owner document to check for dir = rtl;r=gl
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 05 Apr 2018 12:52:35 +0200
changeset 411992 b401fc737a4fbd3d8990fc858cfe5a5cae388dec
parent 411991 4a148fbce5fc1db6d5ee6facf1a429057b815b50
child 411993 6f120441cdd01ff70a479acef8022651be5ba91e
push id33778
push userapavel@mozilla.com
push dateFri, 06 Apr 2018 09:57:38 +0000
treeherdermozilla-central@46a5fc19bd7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1451690
milestone61.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 1451690 - Use SplitBox owner document to check for dir = rtl;r=gl MozReview-Commit-ID: DnAjzEOVbz
devtools/client/shared/components/splitter/SplitBox.js
--- a/devtools/client/shared/components/splitter/SplitBox.js
+++ b/devtools/client/shared/components/splitter/SplitBox.js
@@ -152,19 +152,23 @@ class SplitBox extends Component {
    */
   onMove(x, y) {
     const node = ReactDOM.findDOMNode(this);
 
     let size;
     let { endPanelControl } = this.props;
 
     if (this.state.vert) {
+      // Use the document owning the SplitBox to detect rtl. The global document might be
+      // the one bound to the toolbox shared BrowserRequire, which is irrelevant here.
+      const doc = node.ownerDocument;
+
       // Switch the control flag in case of RTL. Note that RTL
       // has impact on vertical splitter only.
-      if (document.dir === "rtl") {
+      if (doc.dir === "rtl") {
         endPanelControl = !endPanelControl;
       }
 
       size = endPanelControl ?
         (node.offsetLeft + node.offsetWidth) - x :
         x - node.offsetLeft;
 
       this.setState({