Bug 1457838 - Shape editor: account for scrollbars when dragging markers to the edges of the viewport. r=pbro
authorRazvan Caliman <rcaliman@mozilla.com>
Fri, 27 Apr 2018 15:22:00 +0200
changeset 472421 f2e2f5d4f04574ca9838d86a2a70be7ccb709db2
parent 472420 dc916a5c4dc81b31f7906df23762e43bca76feef
child 472422 9306053288b663041576285ae1a0e4c83c52447e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1457838
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
     }