Bug 1457838 - Shape editor: account for scrollbars when dragging markers to the edges of the viewport. r=pbro
MozReview-Commit-ID: HsoLfpxZWrh
--- a/devtools/server/actors/highlighters/shapes.js
+++ b/devtools/server/actors/highlighters/shapes.js
@@ -456,21 +456,22 @@ class ShapesHighlighter extends AutoRefr
const win = this.win;
const nodeWin = this.currentNode.ownerGlobal;
// Get bounding box of iframe document relative to global document.
const { bounds } = nodeWin.document.getBoxQuads({ relativeTo: win.document })[0];
xOffset = bounds.left - nodeWin.scrollX + win.scrollX;
yOffset = bounds.top - nodeWin.scrollY + win.scrollY;
}
- const { pageXOffset, pageYOffset, innerWidth, innerHeight } = this.win;
+ const { pageXOffset, pageYOffset } = this.win;
+ const { clientHeight, clientWidth } = this.win.document.documentElement;
const left = pageXOffset + padding - xOffset;
- const right = innerWidth + pageXOffset - padding - xOffset;
+ const right = clientWidth + pageXOffset - padding - xOffset;
const top = pageYOffset + padding - yOffset;
- const bottom = innerHeight + pageYOffset - padding - yOffset;
+ const bottom = clientHeight + pageYOffset - padding - yOffset;
this.viewport = { left, right, top, bottom, padding };
}
handleEvent(event, id) {
// No event handling if the highlighter is hidden
if (this.areShapesHidden()) {
return;
}