Bug 1450650 - 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 789040 57509e77448d7b8f4ab47af3fea363545b7c95d6
parent 789020 d2d518b1f8730eb61554df7179ef9a2aeed4d843
push id108146
push userbmo:rcaliman@mozilla.com
push dateFri, 27 Apr 2018 13:22:47 +0000
reviewerspbro
bugs1450650
milestone61.0a1
Bug 1450650 - 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;
     }