[Pkg-mozext-commits] [tabmixplus] 30/44: Use ordinal-group to move tab-close-button to left side

David Prévot taffit at moszumanska.debian.org
Wed Oct 15 02:10:04 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 d4ca22bb01a7917bc9eb1c2717bde0cf0029b9af
Author: onemen <tabmix.onemen at gmail.com>
Date:   Tue Oct 7 18:39:08 2014 +0300

    Use ordinal-group to move tab-close-button to left side
---
 chrome/content/extensions/extensions.js |  2 +-
 chrome/content/overlay/browsr.css       | 52 +++++++++++----------------------
 chrome/content/tab/tab.js               | 24 +++++----------
 chrome/content/tab/tabbrowser_4.xml     |  7 +----
 chrome/content/tabmix.js                | 45 +---------------------------
 5 files changed, 27 insertions(+), 103 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index dd046dd..a389af4 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -574,7 +574,7 @@ TMP_extensionsCompatibility.treeStyleTab = {
         ).toCode();
       }
       TreeStyleTabBrowser.prototype.getTabClosebox = function(aTab) {
-        return this.document.getAnonymousElementByAttribute(aTab, 'class', 'tab-close-button close-icon always-right');
+        return this.document.getAnonymousElementByAttribute(aTab, 'class', 'tab-close-button close-icon');
       }
     }
 
diff --git a/chrome/content/overlay/browsr.css b/chrome/content/overlay/browsr.css
index 0ed53e2..6d183c1 100644
--- a/chrome/content/overlay/browsr.css
+++ b/chrome/content/overlay/browsr.css
@@ -11,7 +11,7 @@ label.text-link, label[onclick] {
   -moz-binding: url(chrome://tabmixplus/content/tab/text.xml#tmp-text-link);
 }
 
-/*  we don't use .tabbrowser-tab > .tab-close-button[button_side="right"] here
+/*  we don't use .tabbrowser-tab > .tab-close-button here
     because in some theme the buttons are inside tab-middle
 */
 
@@ -21,53 +21,30 @@ label.text-link, label[onclick] {
   display: none !important;
 }
 
-.tabbrowser-tabs:not([closebuttons="noclose"])[closebuttons-side="left"] > .tabbrowser-tab .tab-close-button[button_side="right"],
-.tabbrowser-tabs:not([closebuttons="noclose"])[closebuttons-side="right"] > .tabbrowser-tab .tab-close-button[button_side="left"] {
-  display: none !important;
-}
-
 .tabbrowser-tab[protected] .tab-close-button {
   display: none !important;
 }
 
-.tabbrowser-tabs[favhideclose="true"] > .tabbrowser-tab[faviconized="true"] .tab-close-button[button_side="left"],
-.tabbrowser-tabs[favhideclose="true"] > .tabbrowser-tab[faviconized="true"] .tab-close-button[button_side="right"] {
+.tabbrowser-tabs[favhideclose="true"] > .tabbrowser-tab[faviconized="true"] .tab-close-button {
    display: none !important;
 }
 
-.tabbrowser-tabs:not([favhideclose="true"])[closebuttons-side="left"][closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button[button_side="left"],
-.tabbrowser-tabs:not([favhideclose="true"])[closebuttons-side="left"][closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="left"] {
-  display: -moz-box !important;
-}
-
-.tabbrowser-tabs:not([favhideclose="true"])[closebuttons-side="right"][closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button[button_side="right"],
-.tabbrowser-tabs:not([favhideclose="true"])[closebuttons-side="right"][closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="right"] {
-  display: -moz-box !important;
-}
-
-.tabbrowser-tabs[favhideclose="true"][closebuttons-side="left"][closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button[button_side="left"],
-.tabbrowser-tabs[favhideclose="true"][closebuttons-side="left"][closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="left"] {
-  display: -moz-box !important;
-}
-
-.tabbrowser-tabs[favhideclose="true"][closebuttons-side="right"][closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button[button_side="right"],
-.tabbrowser-tabs[favhideclose="true"][closebuttons-side="right"][closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="right"] {
+.tabbrowser-tabs:not([favhideclose="true"])[closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button,
+.tabbrowser-tabs:not([favhideclose="true"])[closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([isPermaTab="true"]):not([protected]) .tab-close-button {
   display: -moz-box !important;
 }
 
-/* some theme use display: none !important;  so we must use !important; */
-.tabbrowser-tabs[closebuttons-hover="notactivetab"][closebuttons-side="right"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([selected="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button[button_side="right"],
-.tabbrowser-tabs[closebuttons-hover="alltabs"][closebuttons-side="right"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button[button_side="right"] {
+.tabbrowser-tabs[favhideclose="true"][closebuttons="activetab"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[selected="true"] .tab-close-button,
+.tabbrowser-tabs[favhideclose="true"][closebuttons="alltabs"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button {
   display: -moz-box !important;
 }
 
-.tabbrowser-tabs[closebuttons-hover="notactivetab"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([selected="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button[button_side="left"],
-.tabbrowser-tabs[closebuttons-hover="alltabs"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button[button_side="left"] {
+.tabbrowser-tabs[closebuttons-hover="notactivetab"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([selected="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button,
+.tabbrowser-tabs[closebuttons-hover="alltabs"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected])[showbutton=on] .tab-close-button {
   display: -moz-box !important;
 }
 
 /* button on the left side */
-.tabbrowser-tabs[closebuttons-side="left"][closebuttons="activetab"] > .tabbrowser-tab[selected="true"] > .tab-stack > .tab-content > .tab-close-button,
 .tabbrowser-tabs[closebuttons-side="left"][closebuttons-hover="notactivetab"] > .tabbrowser-tab:not([selected="true"]) > .tab-stack > .tab-content > .tab-icon,
 .tabbrowser-tabs[closebuttons-side="left"][closebuttons-hover="alltabs"] > .tabbrowser-tab > .tab-stack > .tab-content > .tab-icon {
   -moz-box-ordinal-group: 0 !important;
@@ -84,13 +61,18 @@ label.text-link, label[onclick] {
   -moz-box-ordinal-group: 2 !important;
 }
 
-/*  for PermaTab */
-/*  show PermaTab icon only on right side only right  */
-.tabbrowser-tab[isPermaTab="true"] .tab-close-button[button_side="left"] {
-  display: none !important;
+.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons-hover])[closebuttons-side="left"] > .tabbrowser-tab > .tab-stack > .tab-content > *:not(.tab-close-button) {
+  -moz-box-ordinal-group: 5 !important;
+}
+
+.tabbrowser-tabs[closebuttons-side="left"][closebuttons-hover="notactivetab"] > .tabbrowser-tab[selected="true"] > .tab-stack > .tab-content > .tab-close-button,
+.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons-hover])[closebuttons-side="left"] > .tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button {
+  direction: rtl;
+  -moz-box-ordinal-group: 0 !important;
 }
 
 /* for themes that use old tabmix xml version */
+.tab-close-button[button_side="left"],
 .tabbrowser-tab .showhover-box,
 .tabbrowser-tab .showhover-flex {
   display: none !important;
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index dc0bc43..2d7c994 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1045,27 +1045,15 @@ var gTMPprefObserver = {
   },
 
   setCloseButtonMargin: function TMP_PO_setCloseButtonMargin() {
-    var [sMarginStart, sMarginEnd] = Tabmix.rtl ? ["margin-right", "margin-left"] : ["margin-left", "margin-right"];
-    var icon = document.getAnonymousElementByAttribute(gBrowser.mCurrentTab, "button_side", "right") ||
-               document.getAnonymousElementByAttribute(gBrowser.mCurrentTab, "class", "tab-close-button close-icon always-right");
+    var sMarginEnd = Tabmix.rtl ? "margin-left" : "margin-right";
+    var icon = document.getAnonymousElementByAttribute(gBrowser.mCurrentTab, "anonid", "tmp-close-button");
     if (!icon)
       return; // nothing to do....
 
-    let style = window.getComputedStyle(icon, null);
-    let marginStart = style.getPropertyValue(sMarginStart);
-    let marginEnd = style.getPropertyValue(sMarginEnd);
-    // swap button margin-left margin-right for button on the left side
-    if (marginStart != marginEnd) {
-      let newRule = '.tab-close-button[button_side="left"] {' +
-                    '-moz-margin-start: %PX !important;'.replace("%PX", marginEnd) +
-                    '-moz-margin-end: %PX !important;}'.replace("%PX", marginStart);
-      this.insertRule(newRule);
-    }
-
     // move left button that show on hover over tab title
     icon.style.setProperty("display", "-moz-box", "important");
-    let iconMargin = '.tabbrowser-tabs[closebuttons-hover="notactivetab"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([selected="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="left"],' +
-                     '.tabbrowser-tabs[closebuttons-hover="alltabs"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button[button_side="left"] {' +
+    let iconMargin = '.tabbrowser-tabs[closebuttons-hover="notactivetab"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([selected="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button,' +
+                     '.tabbrowser-tabs[closebuttons-hover="alltabs"][closebuttons-side="left"] > .tabbrowser-tab:not([pinned]):not([faviconized="true"]):not([isPermaTab="true"]):not([protected]) .tab-close-button {' +
                      '-moz-margin-start: 0px !important;' +
                      '-moz-margin-end: %Spx !important;}'.replace("%S", - icon.getBoundingClientRect().width);
     icon.style.removeProperty("display");
@@ -1073,9 +1061,11 @@ var gTMPprefObserver = {
 
     // set right margin to tab-label when close button is not right to it
     // on default theme the margin is zero, so we set the end margin to be the same as the start margin
+    let style = window.getComputedStyle(icon, null);
+    let marginEnd = style.getPropertyValue(sMarginEnd);
     let textMarginEnd = parseInt(marginEnd) ? marginEnd : this._marginStart;
     delete this._marginStart;
-    let iconRule = '.tabbrowser-tabs%favhideclose%[closebuttons="noclose"] > .tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
+             let iconRule = '.tabbrowser-tabs%favhideclose%[closebuttons="noclose"] > .tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
                             '.tabbrowser-tabs%favhideclose%[closebuttons-side="left"] > .tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
                             '.tabbrowser-tabs%favhideclose%[closebuttons="activetab"]:not([closebuttons-hover="notactivetab"])[closebuttons-side="right"] > .tabbrowser-tab%faviconized%:not([pinned]):not([selected="true"]) .tab-label[tabmix="true"],' +
                             '.tabbrowser-tab%faviconized1%[protected]:not([pinned]) .tab-label[tabmix="true"] {' +
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 7f268d3..8ea6f83 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -58,10 +58,6 @@
         </xul:vbox>
         <xul:hbox xbl:inherits="pinned,selected,titlechanged"
                   class="tab-content" align="center">
-          <xul:toolbarbutton anonid="tmp-close-button"
-                             xbl:inherits="fadein,pinned,selected"
-                             button_side="left"
-                             class="tab-close-button close-icon always-left"/>
             <xul:stack class="tab-icon" xbl:inherits="fadein,pinned,selected">
               <xul:image xbl:inherits="fadein,pinned,busy,progress,selected"
                          class="tab-throbber"
@@ -81,8 +77,7 @@
                      role="presentation"/>
           <xul:toolbarbutton anonid="tmp-close-button"
                              xbl:inherits="fadein,pinned,selected"
-                             button_side="right"
-                             class="tab-close-button close-icon always-right"/>
+                             class="tab-close-button close-icon"/>
         </xul:hbox>
       </xul:stack>
       <xul:hbox class="tab-drag-indicator-right"/>
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index a2d663f..8882e73 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1080,10 +1080,9 @@ var TMP_eventListener = {
     }
   },
 
-  // some theme not useing updated Tabmix tab binding
+  // some theme not useing up to date Tabmix tab binding
   // we check here that all of our attribute exist
   setTabAttribute: function TMP_EL_setTabAttribute(aTab) {
-//XXX need to improve this
     let reloadIcon  = document.getAnonymousElementByAttribute(aTab, "class", "tab-reload-icon");
     if (!reloadIcon) {
       let lockIcon  = document.getAnonymousElementByAttribute(aTab, "class", "tab-lock-icon");
@@ -1101,48 +1100,6 @@ var TMP_eventListener = {
         node.setAttribute(aAtt, aValue);
     }
 
-    let button = document.getAnonymousElementByAttribute(aTab, "button_side", "left");
-    if (button)
-      return;
-
-    let leftButton;
-    let rightButton;
-    let tabMiddle, tabContent;
-    let classString = /tab-middle|box-inherit|tab-image-middle|tab-body/;
-
-    function getCloseButtons(aNodes) {
-      Array.slice(aNodes).forEach(function(aNode) {
-        if (leftButton && rightButton)
-          return;
-        if (/tab-stack/.test(aNode.getAttribute("class")))
-          tabContent = aNode.firstChild;
-        else if (classString.test(aNode.getAttribute("class")))
-          tabMiddle = aNode;
-        else if (aNode.localName == "toolbarbutton" && aNode.getAttribute("anonid") == "tmp-close-button") {
-          if (leftButton) {
-            rightButton = aNode;
-            aNode.setAttribute("button_side", "right");
-          }
-          else {
-            leftButton = aNode;
-            aNode.setAttribute("button_side", "left");
-          }
-        }
-      });
-    }
-
-    // 1st search in tab
-    getCloseButtons(document.getAnonymousNodes(aTab));
-    // 2nd search in tab-content - Firefox 4.0
-    if (!rightButton && !leftButton && tabContent)
-      getCloseButtons(tabContent.childNodes);
-    // 3nd search in tab-middle
-    if (!rightButton && !leftButton && tabMiddle)
-      getCloseButtons(tabMiddle.childNodes);
-    // only one button !
-    if (!rightButton && leftButton)
-      leftButton.setAttribute("button_side", "right");
-
     aTab.setAttribute("context", gBrowser.tabContextMenu.id);
 
     updateAttrib("class", "tab-icon-image", "role", "presentation");

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