Bug 1457838 - Shape editor: account for scrollbars when dragging markers to the edges of the viewport. r=pbro draft
authorRazvan Caliman <rcaliman@mozilla.com>
Fri, 27 Apr 2018 15:22:00 +0200
changeset 789698 d492359c86d5a5b120cdd7380bd7cb8de34fc332
parent 789560 c552490c8659bf2e7d279ed28d46fb5d5a245a96
push id108311
push userbmo:rcaliman@mozilla.com
push dateMon, 30 Apr 2018 09:46:40 +0000
reviewerspbro
bugs1457838
milestone61.0a1
Bug 1457838 - Shape editor: account for scrollbars when dragging markers to the edges of the viewport. r=pbro MozReview-Commit-ID: HsoLfpxZWrh
devtools/server/actors/highlighters/shapes.js
--- 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;
     }