[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 245/483: Restored old behavior - move selection label up a little if there is not enough space at the bottom

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:45 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 fc57bfd0da6cd1eb62602e0aa2e7ab7283d83a8d
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Oct 25 15:21:22 2010 +0200

    Restored old behavior - move selection label up a little if there is not enough space at the bottom
---
 chrome/content/elementmarker.css | 15 +++++++++++++++
 modules/Aardvark.jsm             | 13 ++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/chrome/content/elementmarker.css b/chrome/content/elementmarker.css
index cd2da67..14293a4 100644
--- a/chrome/content/elementmarker.css
+++ b/chrome/content/elementmarker.css
@@ -68,6 +68,8 @@
 .%%CLASS%% > .border
 {
   border: 2px solid #ff0000 !important;
+  top: auto !important;
+  left: auto !important;
 }
 
 .%%CLASS%% > .label
@@ -80,10 +82,21 @@
   -moz-border-radius-bottomleft: 6px !important;
   -moz-border-radius-bottomright: 6px !important;
   padding: 2px 5px !important;
+  top: auto !important;
+  left: auto !important;
   width: auto !important;
   height: auto !important;
 }
 
+.%%CLASS%% > .label.onTop
+{
+  position: relative !important;
+  left: 5px !important;
+  top: -25px !important;
+  border-top-width: 1px !important;
+  -moz-border-radius: 6px !important;
+}
+
 .%%CLASS%% > .label > .labelTag,
 .%%CLASS%% > .label > .labelAddition
 {
@@ -92,6 +105,8 @@
   font-size: 12px !important;
   color: #000000 !important;
 
+  top: auto !important;
+  left: auto !important;
   width: auto !important;
   height: auto !important;
   direction: ltr !important;
diff --git a/modules/Aardvark.jsm b/modules/Aardvark.jsm
index 1bb30b6..6997513 100644
--- a/modules/Aardvark.jsm
+++ b/modules/Aardvark.jsm
@@ -259,6 +259,7 @@ Aardvark.showBoxAndLabel = function(elem, string)
   this.selectedElem = elem;
 
   let border = this.boxElem.getElementsByClassName("border")[0];
+  let label = this.boxElem.getElementsByClassName("label")[0];
   let labelTag = this.boxElem.getElementsByClassName("labelTag")[0];
   let labelAddition = this.boxElem.getElementsByClassName("labelAddition")[0];
 
@@ -268,9 +269,19 @@ Aardvark.showBoxAndLabel = function(elem, string)
   border.style.width = (pos.right - pos.left - 2) + "px";
   border.style.height = (pos.bottom - pos.top - 2) + "px";
 
+  let doc = this.browser.contentDocument;
+
   [labelTag.textContent, labelAddition.textContent] = this.makeElementLabelString(elem);
 
-  let doc = this.browser.contentDocument;
+  // 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)
+    label.className = "label";
+  else
+    label.className = "label onTop";
+  
   if (this.boxElem.ownerDocument != doc)
     this.boxElem = doc.importNode(this.boxElem, true);
   doc.documentElement.appendChild(this.boxElem);

-- 
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