Bug 1468953: Use node bounds in viewport instead of offsets from offsetParent. r?jdescottes
MozReview-Commit-ID: nqMLetevCZ
--- a/devtools/client/shared/components/splitter/SplitBox.js
+++ b/devtools/client/shared/components/splitter/SplitBox.js
@@ -161,42 +161,43 @@ class SplitBox extends Component {
/**
* Adjust size of the controlled panel. Depending on the current
* orientation we either remember the width or height of
* the splitter box.
*/
onMove(x, y) {
const node = ReactDOM.findDOMNode(this);
+ const nodeBounds = node.getBoundingClientRect();
let size;
let { endPanelControl, vert } = this.state;
if (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 (doc.dir === "rtl") {
endPanelControl = !endPanelControl;
}
size = endPanelControl ?
- (node.offsetLeft + node.offsetWidth) - x :
- x - node.offsetLeft;
+ (nodeBounds.left + nodeBounds.width) - x :
+ x - nodeBounds.left;
this.setState({
width: size
});
} else {
size = endPanelControl ?
- (node.offsetTop + node.offsetHeight) - y :
- y - node.offsetTop;
+ (nodeBounds.top + nodeBounds.height) - y :
+ y - nodeBounds.top;
this.setState({
height: size
});
}
}
// Rendering