Bug 1447043 - Calculate top and left selection margin using left and top. r=_6a68, a=jcristau
authorBarry Chen <chenba@gmail.com>
Mon, 19 Mar 2018 09:31:57 -0700
changeset 462791 760683bdddb4a8d4e19444824b2153f5fc53923c
parent 462790 a16f636c81ebb4c995b6d64966557ccde9a4559f
child 462792 67b517c61b1f86e098a72ec95083c3315086cd9c
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewers_6a68, jcristau
bugs1447043
milestone60.0
Bug 1447043 - Calculate top and left selection margin using left and top. r=_6a68, a=jcristau MozReview-Commit-ID: 88TM8xgATPC
browser/extensions/screenshots/webextension/selector/ui.js
--- a/browser/extensions/screenshots/webextension/selector/ui.js
+++ b/browser/extensions/screenshots/webextension/selector/ui.js
@@ -212,18 +212,18 @@ this.ui = (function() { // eslint-disabl
         // Since this frame has an absolute position relative to the parent
         // document, if the parent document's body has a relative position and
         // left and/or top not at 0, then the left and/or top of the parent
         // document's body is not at (0, 0) of the viewport. That makes the
         // frame shifted relative to the viewport. These margins negates that.
         if (window.getComputedStyle(document.body).position === "relative") {
           const docBoundingRect = document.documentElement.getBoundingClientRect();
           const bodyBoundingRect = document.body.getBoundingClientRect();
-          this.element.style.marginLeft = `-${bodyBoundingRect.right - docBoundingRect.right}px`;
-          this.element.style.marginTop = `-${bodyBoundingRect.bottom - docBoundingRect.bottom}px`;
+          this.element.style.marginLeft = `-${bodyBoundingRect.left - docBoundingRect.left}px`;
+          this.element.style.marginTop = `-${bodyBoundingRect.top - docBoundingRect.top}px`;
         }
       }
       if (force && visible) {
         this.element.style.display = "";
       }
     },
 
     initSizeWatch() {