[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 266/483: Reverted changeset acb68b46052c, use a different hack to calculate document height instead

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 c5248b271707c6af0d7595f575c7aa91a6bd737e
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed Oct 27 10:39:38 2010 +0200

    Reverted changeset acb68b46052c, use a different hack to calculate document height instead
---
 modules/Aardvark.jsm | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

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