[Pkg-mozext-commits] [tabmixplus] 73/123: Replace visibility: collapse with display: none; to hide 'new-tab-button' after tabs. Some themes or extensions add width or height css rules with important, this can mess our multi-row height when we hide 'new-tab-button' after tabs.

David Prévot taffit at moszumanska.debian.org
Wed Sep 17 21:16:28 UTC 2014


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit 07dcb1143d23863d07651266d286e5b117a98624
Author: onemen <tabmix.onemen at gmail.com>
Date:   Wed Sep 3 10:34:17 2014 +0300

    Replace visibility: collapse with display: none; to hide 'new-tab-button' after tabs. Some themes or extensions add width or height css rules with important, this can mess our multi-row height when we hide 'new-tab-button' after tabs.
---
 chrome/content/overlay/browsr.css   | 17 ++++++++---------
 chrome/content/tab/tab.js           |  3 ---
 chrome/content/tab/tabbrowser_4.xml |  2 +-
 chrome/content/tabmix.js            | 11 ++++++-----
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/chrome/content/overlay/browsr.css b/chrome/content/overlay/browsr.css
index d233d34..2a23ea4 100644
--- a/chrome/content/overlay/browsr.css
+++ b/chrome/content/overlay/browsr.css
@@ -133,15 +133,18 @@ label.text-link, label[onclick] {
   margin: 0px;
 }
 
+
+/* we use this rule in tabmix.js Tabmix.getAfterTabsButtonsWidth */
+#TabsToolbar > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .tabs-newtab-button[force-display] {
+  display: -moz-box !important;
+}
+
 /*** hide tabs-newtab-button that we don't use ***/
 #TabsToolbar:not([currentset*="privateTab-toolbar-openNewPrivateTab"]) #privateTab-afterTabs-openNewPrivateTab,
 #tabbrowser-tabs[overflow="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button,
 #TabsToolbar:not([tabmix-show-newtabbutton]) .tabbrowser-arrowscrollbox > .tabs-newtab-button[command="cmd_newNavigatorTab"],
 #TabsToolbar[tabmix-show-newtabbutton*="side"] .tabbrowser-arrowscrollbox > .tabs-newtab-button {
-  /* using visibility: hidden !important; don't collapse the width and don't collapse padding and border height */
-  visibility: collapse;
-  height: 0px !important;
-  width: 0px;
+  display: none;
   border: none;
   margin: 0px;
   vertical-align: bottom;
@@ -149,11 +152,7 @@ label.text-link, label[onclick] {
 
 #TabsToolbar[tabmix-show-newtabbutton="aftertabs"]:not([customizing="true"]) >
    #tabbrowser-tabs:not([overflow="true"]) > .tabbrowser-arrowscrollbox > .tabs-newtab-button[command="cmd_newNavigatorTab"] {
-  visibility: visible;
-}
-
-#TabsToolbar[tabmix-show-newtabbutton="afterTabs-force"] .tabbrowser-arrowscrollbox > .tabs-newtab-button {  /* look in tabmix.js */
-  visibility: visible !important;
+  display: -moz-box;
 }
 
 #TabsToolbar[tabmix-show-newtabbutton*="side"] > #new-tab-button {
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 99dadda..b729f8b 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1430,9 +1430,6 @@ var gTMPprefObserver = {
 
    /** values for tabmix-show-newtabbutton to show tabs-newtab-button are:
     *  aftertabs       - show the button after tabs
-    *  aftertabs-force - force the button after tabs to be visible, only to
-    *                    make it possible to catch the button width
-    *                   (Tabmix.getAfterTabsButtonsWidth)
     *  temporary-right-side
     *                  - show the button on right side when there is no place
     *                    for the button aftertabs in multi-row mode
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 0c8b0c3..8f9a641 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -414,7 +414,7 @@
            * if we set this in field[s] they will reset each time the tabbar binding construct
            * by tabbar position change
            */
-          Tabmix.afterTabsButtonsWidth = [Tabmix.isVersion(280) ? 37.2 : 28];
+          Tabmix.afterTabsButtonsWidth = [Tabmix.isVersion(280) ? 51.6 : 28];
           Tabmix.tabsNewtabButton =
             document.getAnonymousElementByAttribute(this, "command", "cmd_newNavigatorTab");
           Tabmix._show_newtabbutton = "aftertabs";
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 49ba3a0..eb7b679 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -142,12 +142,11 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
     if (stripIsHidden)
       tabBar.visible = true;
     let tabsToolbar = document.getElementById("TabsToolbar");
-    let currentButtonVisibility = tabsToolbar.getAttribute("tabmix-show-newtabbutton");
-    this.setItem(tabsToolbar, "tabmix-show-newtabbutton", "aftertabs-force");
     // save tabsNewtabButton width
     let lwtheme = !this.isVersion(280) && document.getElementById("main-window").getAttribute("lwtheme");
     this.tabsNewtabButton =
       document.getAnonymousElementByAttribute(tabBar, "command", "cmd_newNavigatorTab");
+    this.tabsNewtabButton.setAttribute("force-display", true);
     let openNewTabRect = this.tabsNewtabButton.getBoundingClientRect();
     let style = window.getComputedStyle(this.tabsNewtabButton, null);
     let marginStart = style.getPropertyValue("margin-left");
@@ -155,8 +154,10 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
     // let marginEnd = style.getPropertyValue("margin-right");
     // let buttonWidth = openNewTabRect.width + parseFloat(marginStart) + parseFloat(marginEnd);
     let buttonWidth = openNewTabRect.width + parseFloat(marginStart);
-    this.afterTabsButtonsWidth = [];
-    this.afterTabsButtonsWidth.push(lwtheme ? 31 : buttonWidth);
+    if (buttonWidth > 0) {
+      this.afterTabsButtonsWidth = [];
+      this.afterTabsButtonsWidth.push(lwtheme ? 31 : buttonWidth);
+    }
 
     // when privateTab extension installed add its new tab button width
     // for the use of adjustNewtabButtonvisibility set tabsNewtabButton to be
@@ -168,7 +169,7 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
       if (openNewPrivateTabRect.right > openNewTabRect.right)
         this.tabsNewtabButton = openNewPrivateTab;
     }
-    this.setItem(tabsToolbar, "tabmix-show-newtabbutton", currentButtonVisibility || null);
+    this.tabsNewtabButton.removeAttribute("force-display", true);
     if (stripIsHidden)
       tabBar.visible = false;
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list