Bug 1451690 - Use SplitBox owner document to check for dir = rtl;r=gl draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 05 Apr 2018 12:52:35 +0200
changeset 777825 5f25a91773345e5274377b57c27d56195bb56109
parent 777163 ff0efa4132f0efd78af0910762aec7dcc1a8de66
push id105297
push userjdescottes@mozilla.com
push dateThu, 05 Apr 2018 10:52:59 +0000
reviewersgl
bugs1451690
milestone61.0a1
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,24 @@ 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 splitBox = ReactDOM.findDOMNode(this);
+      const doc = splitBox.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({