[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 264/483: Fixed: Window size would sometimes be determined incorrectly, messed up displayed element dimensions

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.

commit 1712a63a4a682e768fda6f083700d7dbe376ed6f
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed Oct 27 09:59:45 2010 +0200

    Fixed: Window size would sometimes be determined incorrectly, messed up displayed element dimensions
---
 modules/Aardvark.jsm | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/modules/Aardvark.jsm b/modules/Aardvark.jsm
index d1bd458..060dd3e 100644
--- a/modules/Aardvark.jsm
+++ b/modules/Aardvark.jsm
@@ -87,10 +87,8 @@ var Aardvark =
       this.showMenu();
   
     // Make sure to select some element immeditely (whichever is in the center of the browser window)
-    let wndWidth = doc.documentElement.clientWidth;
-    let wndHeight = doc.documentElement.clientHeight;
-    if (doc.compatMode == "BackCompat") // clientHeight will be bogus in quirks mode
-      wndHeight = doc.documentElement.offsetHeight - doc.defaultView.scrollMaxY;
+    let wndWidth = doc.defaultView.innerWidth;
+    let wndHeight = doc.defaultView.innerHeight;
     this.isUserSelected = false;
     this.onMouseMove({clientX: wndWidth / 2, clientY: wndHeight / 2, screenX: -1, screenY: -1, target: null});
   },
@@ -373,10 +371,7 @@ var Aardvark =
     [labelTag.textContent, labelAddition.textContent] = this.getElementLabel(elem);
   
     // If there is not enough space to show the label move it up a little
-    let wndHeight = doc.documentElement.clientHeight;
-    if (doc.compatMode == "BackCompat") // clientHeight will be bogus in quirks mode
-      wndHeight = doc.documentElement.offsetHeight - doc.defaultView.scrollMaxY;
-    if (pos.bottom < wndHeight - 25)
+    if (pos.bottom < doc.defaultView.innerHeight - 25)
       label.className = "label";
     else
       label.className = "label onTop";
@@ -405,16 +400,10 @@ var Aardvark =
     // Restrict rectangle coordinates by the boundaries of a window's client area
     function intersectRect(rect, wnd)
     {
-      let doc = wnd.document;
-      let wndWidth = doc.documentElement.clientWidth;
-      let wndHeight = doc.documentElement.clientHeight;
-      if (doc.compatMode == "BackCompat") // clientHeight will be bogus in quirks mode
-        wndHeight = doc.documentElement.offsetHeight - wnd.scrollMaxY;
-  
       rect.left = Math.max(rect.left, 0);
       rect.top = Math.max(rect.top, 0);
-      rect.right = Math.min(rect.right, wndWidth);
-      rect.bottom = Math.min(rect.bottom, wndHeight);
+      rect.right = Math.min(rect.right, wnd.innerWidth);
+      rect.bottom = Math.min(rect.bottom, wnd.innerHeight);
     }
   
     let rect = element.getBoundingClientRect();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git



More information about the Pkg-mozext-commits mailing list