Bug 1468953: Use node bounds in viewport instead of offsets from offsetParent. r=jdescottes

MozReview-Commit-ID: nqMLetevCZ

--HG--
extra : rebase_source : 8ca955be72b36a7554024103ceede82bce0b5076
This commit is contained in:
Daisuke Akatsuka 2018-06-26 10:51:40 +09:00
Родитель 63dbf9d6f7
Коммит f24d951078
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -166,6 +166,7 @@ class SplitBox extends Component {
*/ */
onMove(x, y) { onMove(x, y) {
const node = ReactDOM.findDOMNode(this); const node = ReactDOM.findDOMNode(this);
const nodeBounds = node.getBoundingClientRect();
let size; let size;
let { endPanelControl, vert } = this.state; let { endPanelControl, vert } = this.state;
@ -182,16 +183,16 @@ class SplitBox extends Component {
} }
size = endPanelControl ? size = endPanelControl ?
(node.offsetLeft + node.offsetWidth) - x : (nodeBounds.left + nodeBounds.width) - x :
x - node.offsetLeft; x - nodeBounds.left;
this.setState({ this.setState({
width: size width: size
}); });
} else { } else {
size = endPanelControl ? size = endPanelControl ?
(node.offsetTop + node.offsetHeight) - y : (nodeBounds.top + nodeBounds.height) - y :
y - node.offsetTop; y - nodeBounds.top;
this.setState({ this.setState({
height: size height: size