[Pkg-mozext-commits] [tabmixplus] 98/123: Add TabmixTabbar.flowing setter to change flowing attribute in one place

David Prévot taffit at moszumanska.debian.org
Wed Sep 17 21:16:31 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 e62754995bc82e77db134d3f000a7662db233942
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Sep 11 07:14:44 2014 +0300

    Add TabmixTabbar.flowing setter to change flowing attribute in one place
---
 chrome/content/links/setup.js       |  4 +--
 chrome/content/tab/tab.js           | 53 +++++++++++++++----------------------
 chrome/content/tab/tabbrowser_4.xml |  2 +-
 3 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index b475844..a967aac 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -303,9 +303,7 @@ Tabmix.beforeStartup = function TMP_beforeStartup(tabBrowser, aTabContainer) {
     }
     TabmixTabbar.scrollButtonsMode = tabscroll;
     let flowing = ["singlebar", "scrollbutton", "multibar", "scrollbutton"][tabscroll];
-    this.setItem(tabContainer, "flowing", flowing);
-    tabContainer.mTabstrip.setAttribute("flowing", flowing);
-    this.setItem("tabmixScrollBox", "flowing", flowing);
+    TabmixTabbar.flowing = flowing;
 
     // add flag that we are after SwitchThemes, we use it in Tabmix.isWindowAfterSessionRestore
     if ("SwitchThemesModule" in window && SwitchThemesModule.windowsStates && SwitchThemesModule.windowsStates.length)
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 10d80de..f9377fa 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -13,8 +13,24 @@ var TabmixTabbar = {
   SCROLL_BUTTONS_MULTIROW: 2,
   SCROLL_BUTTONS_RIGHT: 3,
 
+  set flowing(val) {
+    Tabmix.setItem(gBrowser.tabContainer, "flowing", val);
+    Tabmix.setItem(gBrowser.tabContainer.mTabstrip, "flowing", val);
+
+    let tabmixScrollBox = document.getElementById("tabmixScrollBox");
+    Tabmix.setItem(tabmixScrollBox, "flowing", val);
+    // we have to set orient attribute for Linux theme,
+    // maybe other themes need it for display the scroll arrow
+    Tabmix.setItem(tabmixScrollBox, "orient", val == "multibar" ? "vertical" : "horizontal");
+    return val
+  },
+
+  get flowing() {
+    return gBrowser.tabContainer.getAttribute("flowing");
+  },
+
   get isMultiRow() {
-    return gBrowser.tabContainer.getAttribute("flowing") == "multibar";
+    return this.flowing == "multibar";
   },
 
   isButtonOnTabsToolBar: function(button) {
@@ -55,21 +71,6 @@ var TabmixTabbar = {
       let useTabmixButtons = tabscroll > this.SCROLL_BUTTONS_LEFT_RIGHT;
       let overflow = tabBar.overflow;
 
-      switch (tabscroll) {
-        case this.SCROLL_BUTTONS_HIDDEN:
-          tabBar.setAttribute("flowing", "singlebar");
-          break;
-        case this.SCROLL_BUTTONS_LEFT_RIGHT:
-          tabBar.setAttribute("defaultScrollButtons", true);
-          Tabmix.setItem("tabmixScrollBox", "defaultScrollButtons", true);
-        case this.SCROLL_BUTTONS_RIGHT:
-          tabBar.setAttribute("flowing", "scrollbutton");
-          break;
-        case this.SCROLL_BUTTONS_MULTIROW:
-          tabBar.setAttribute("flowing", "multibar");
-          break;
-      }
-
       // from Firefox 4.0+ on we add dynamicly scroll buttons on TabsToolbar.
       this.setScrollButtonBox(useTabmixButtons, false, true);
       if (isMultiRow || prevTabscroll == this.SCROLL_BUTTONS_MULTIROW) {
@@ -79,9 +80,11 @@ var TabmixTabbar = {
         Tabmix.setItem("tabmixScrollBox", "collapsed", true);
       }
 
-      let flowing = tabBar.getAttribute("flowing");
-      tabStrip.setAttribute("flowing", flowing);
-      Tabmix.setItem("tabmixScrollBox", "flowing", flowing);
+      let flowing = ["singlebar", "scrollbutton", "multibar", "scrollbutton"][tabscroll];
+      this.flowing = flowing;
+      let isDefault = tabscroll == this.SCROLL_BUTTONS_LEFT_RIGHT || null;
+      Tabmix.setItem(tabBar, "defaultScrollButtons", isDefault);
+      Tabmix.setItem("tabmixScrollBox", "defaultScrollButtons", isDefault);
 
       if (prevTabscroll == this.SCROLL_BUTTONS_MULTIROW) {
         tabBar.resetFirstTabInRow();
@@ -100,12 +103,6 @@ var TabmixTabbar = {
       tabBar._positionPinnedTabs();
       if (isMultiRow && TMP_tabDNDObserver.paddingLeft)
         TMP_tabDNDObserver.paddingLeft = Tabmix.getStyle(tabBar, "paddingLeft");
-
-      if (tabscroll != this.SCROLL_BUTTONS_LEFT_RIGHT &&
-            tabBar.hasAttribute("defaultScrollButtons")) {
-        tabBar.removeAttribute("defaultScrollButtons");
-        Tabmix.setItem("tabmixScrollBox", "defaultScrollButtons", null);
-      }
     }
 
     this.widthFitTitle = Tabmix.prefs.getBoolPref("flexTabs") &&
@@ -232,12 +229,6 @@ var TabmixTabbar = {
       tabStrip._scrollButtonUpRight = box._scrollButtonUp;
     }
     if (update) {
-      if (useTabmixButtons) {
-        // we have to set orient attribute for Linux theme
-        // maybe other themes need it for display the scroll arrow
-        box.orient = this.isMultiRow ? "vertical" : "horizontal";
-      }
-
       tabStrip._scrollButtonDown = !useTabmixButtons ?
           tabStrip._scrollButtonDownLeft : tabStrip._scrollButtonDownRight;
       gBrowser.tabContainer._animateElement = tabStrip._scrollButtonDown;
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 21b5268..1ef20f4 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -797,7 +797,7 @@
             TabScope.init();
           }
 
-          this.mTabstrip.setAttribute("flowing", this.getAttribute("flowing"));
+          TabmixTabbar.flowing = this.getAttribute("flowing");
           this.setTabStripOrient();
           let useTabmixButtons = TabmixTabbar.scrollButtonsMode > TabmixTabbar.SCROLL_BUTTONS_LEFT_RIGHT;
           TabmixTabbar.setScrollButtonBox(useTabmixButtons, true, true);

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