[Pkg-mozext-commits] [tabmixplus] 20/48: Follow up bug 1349555 - Implement most of the photon tab strips

David Prévot taffit at moszumanska.debian.org
Sun Aug 20 03:14:36 UTC 2017


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit 9311614046d0395f8f01232c8d64b734aef23a1a
Author: onemen <tabmix.onemen at gmail.com>
Date:   Tue Aug 8 23:38:48 2017 +0300

    Follow up bug 1349555 - Implement most of the photon tab strips
---
 chrome/content/minit/tablib.js               | 12 ++++++-----
 chrome/content/tab/scrollbox.xml             | 12 +++++++----
 chrome/content/tab/tab.js                    | 32 ++++++++++++++++++++++++----
 chrome/content/tab/tabbrowser_4.xml          |  8 +++++--
 chrome/content/tabmix.js                     |  3 +++
 chrome/skin/app_version/41.0/win/browser.css |  5 +++++
 6 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 89cf5b2..4629d80 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -420,6 +420,8 @@ Tabmix.tablib = {
          $&'
       ).toCode();
 
+      let marginInlineStart = Tabmix.isVersion(570) ? "marginInlineStart" : "MozMarginStart";
+      let paddingInlineStart = Tabmix.isVersion(570) ? "paddingInlineStart" : "MozPaddingStart";
       let $LF = '\n          ';
       Tabmix.changeCode(tabBar, "gBrowser.tabContainer._positionPinnedTabs")._replace(
         'this.removeAttribute("positionpinnedtabs");',
@@ -444,19 +446,19 @@ Tabmix.tablib = {
         '      this._pinnedTabsLayoutCache = layoutData;' + $LF +
         '    }' + $LF +
         '  }' + $LF +
-        '    let width = TabmixSvc.australis ? 0 : this.mTabstrip.scrollboxPaddingStart;' +
+        '    let width = TabmixSvc.australis ? 0 : this.mTabstrip.scrollboxPaddingStart || 0;' + $LF +
         '    for (let i = 0; i < numPinned; i++) {' +
         '      let tab = this.childNodes[i];' +
-        '      tab.style.MozMarginStart = width + "px";' +
+        `      tab.style.${marginInlineStart} = width + "px";` + $LF +
         '      width += layoutData.pinnedTabWidth;' +
         '    }' +
         '    if (width != this.mTabstrip.firstTabInRowMargin) {' +
         '      this.mTabstrip.firstTabInRowMargin = width;' +
         '      this.mTabstrip.firstVisible =  {tab: null, x: 0, y: 0};' +
         '      gTMPprefObserver.dynamicRules["tabmix-firstTabInRow"]' +
-        '        .style.setProperty("-moz-margin-start", width + "px", null);' +
+        `        .style.${marginInlineStart} =  width + "px";` + $LF +
         '    }' +
-        '    this.style.MozPaddingStart = "";' +
+        `    this.style.${paddingInlineStart} = "";` + $LF +
         '    TMP_tabDNDObserver.paddingLeft = Tabmix.getStyle(this, "paddingLeft");' +
         '    this.mTabstrip.setFirstTabInRow();' +
         '  }' +
@@ -464,7 +466,7 @@ Tabmix.tablib = {
       )._replace(
         /(})(\)?)$/,
         'if (TabmixTabbar.scrollButtonsMode != TabmixTabbar.SCROLL_BUTTONS_MULTIROW) {' +
-        '  TMP_tabDNDObserver.paddingLeft = parseInt(this.style.MozPaddingStart || 0);' +
+        `  TMP_tabDNDObserver.paddingLeft = parseInt(this.style.${paddingInlineStart} || 0);` +
         '}' +
         '$1$2'
       ).toCode();
diff --git a/chrome/content/tab/scrollbox.xml b/chrome/content/tab/scrollbox.xml
index e902115..b5cefe3 100644
--- a/chrome/content/tab/scrollbox.xml
+++ b/chrome/content/tab/scrollbox.xml
@@ -228,21 +228,25 @@
               'Tabmix.setItem(box, "scrolledtostart", true);'
             )._replace(
               'this.scrollboxPaddingLeft',
-              'this.isMultiRow ? this.scrollboxPaddingTop : $&'
+              'this.isMultiRow ? this.scrollboxPaddingTop : $&',
+              {check: !Tabmix.isVersion(570)}
             )._replace(
               'this.scrollboxPaddingRight',
-              'this.isMultiRow ? this.scrollboxPaddingBottom : $&'
+              'this.isMultiRow ? this.scrollboxPaddingBottom : $&',
+              {check: !Tabmix.isVersion(570)}
             )._replace(
               'this._isRTLScrollbox',
               '$& && !this.isMultiRow'
             )._replace(
               'if (leftOrTopElement',
               `if (this.isMultiRow) {
+                  const _scrollboxPaddingLeft = typeof scrollboxPaddingLeft == "number" ? scrollboxPaddingLeft : 0;
+                  const _scrollboxPaddingRight = typeof scrollboxPaddingRight == "number" ? scrollboxPaddingRight : 0;
                   if (leftOrTopElement &&
-                      leftOrTopEdge(leftOrTopElement) >= leftOrTopEdge(this._scrollbox) + scrollboxPaddingLeft) {
+                      leftOrTopEdge(leftOrTopElement) >= leftOrTopEdge(this._scrollbox) + _scrollboxPaddingLeft) {
                     scrolledToStart = true;
                   } else if (rightOrBottomElement &&
-                             rightOrBottomEdge(rightOrBottomElement) <= rightOrBottomEdge(this._scrollbox) - scrollboxPaddingRight + 2) {
+                             rightOrBottomEdge(rightOrBottomElement) <= rightOrBottomEdge(this._scrollbox) - _scrollboxPaddingRight + 2) {
                     scrolledToEnd = true;
                   }
                 } else $&`
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index dae3705..b3f154a 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -104,7 +104,9 @@ var TabmixTabbar = {
       Tabmix.setItem(tabmixScrollBox, "collapsed", null);
 
       if (gBrowser._numPinnedTabs && tabBar._pinnedTabsLayoutCache) {
-        tabBar._pinnedTabsLayoutCache.paddingStart = tabstrip.scrollboxPaddingStart;
+        if (!Tabmix.isVersion(570)) {
+          tabBar._pinnedTabsLayoutCache.paddingStart = tabstrip.scrollboxPaddingStart;
+        }
         tabBar._pinnedTabsLayoutCache.scrollButtonWidth = tabscroll != this.SCROLL_BUTTONS_LEFT_RIGHT ?
           0 : tabstrip._scrollButtonDown.getBoundingClientRect().width;
       }
@@ -689,6 +691,7 @@ Tabmix.tabsUtils = {
     // initialize first tab
     Tabmix._nextSelectedID = 1;
     TMP_eventListener.setTabAttribute(tab);
+    setTimeout(() => TMP_eventListener.setTabAttribute(tab), 500);
     tab.setAttribute("tabmix_selectedID", Tabmix._nextSelectedID++);
     tab.setAttribute("visited", true);
     Tabmix.setTabStyle(tab);
@@ -1880,8 +1883,28 @@ gTMPprefObserver = {
       this.insertRule(newRule, "pb-indicator-height");
     }
 
-    if (TabmixSvc.isMac && !TabmixSvc.australis)
+    if (!Tabmix.isVersion(570) && TabmixSvc.isMac && !TabmixSvc.australis) {
       Tabmix._buttonsHeight = 24;
+    }
+
+    if (Tabmix.isVersion(570) && !TabmixSvc.australis) {
+      newRule = `.tabbrowser-tabs[flowing="multibar"] > .tabbrowser-tab {
+        height: ${Tabmix._buttonsHeight}px;
+      }`;
+      this.insertRule(newRule);
+
+      newRule = `.tab-stack > .tab-background > .tab-background-start,
+                 .tab-stack > .tab-background > .tab-background-middle,
+                 .tab-stack > .tab-background > .tab-background-end {
+                    display: none;
+                 }`;
+      this.insertRule(newRule);
+    } else if (!Tabmix.isVersion(570)) {
+      newRule = `.tab-stack > .tab-background > .tab-line {
+                    display: none;
+                 }`;
+      this.insertRule(newRule);
+    }
 
     newRule = '#tabmixScrollBox[flowing="multibar"] > toolbarbutton {' +
       '  height: #px;}'.replace("#", Tabmix._buttonsHeight);
@@ -1972,9 +1995,10 @@ gTMPprefObserver = {
     newRule = newRule.replace("#1", _min).replace("#2", _max);
     this.insertRule(newRule, "width");
 
-    // rule for controlling moz-margin-start when we have pinned tab in multi-row
+    // rule for controlling margin-inline-start when we have pinned tab in multi-row
+    let marginInlineStart = Tabmix.isVersion(570) ? "margin-inline-start" : "-moz-margin-start";
     let marginStart = '#tabbrowser-tabs[positionpinnedtabs] > ' +
-                      '.tabbrowser-tab[tabmix-firstTabInRow="true"]{-moz-margin-start: 0px;}';
+                      `.tabbrowser-tab[tabmix-firstTabInRow="true"]{${marginInlineStart}: 0px;}`;
     this.insertRule(marginStart, "tabmix-firstTabInRow");
 
     // for ColorfulTabs 8.0+
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 2083cc1..7e02b0b 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -35,6 +35,8 @@
       <xul:stack class="tab-stack" flex="1">
         <xul:hbox xbl:inherits="pinned,selected=visuallyselected,fadein"
                   class="tab-background">
+          <xul:hbox xbl:inherits="selected=visuallyselected"
+                    class="tab-line"/>
           <xul:hbox xbl:inherits="pinned,selected=visuallyselected"
                     class="tab-background-start"/>
           <xul:hbox xbl:inherits="pinned,selected=visuallyselected"
@@ -381,7 +383,9 @@
 
           var scrollRect = this.mTabstrip.scrollClientRect;
           var tab = aTab.getBoundingClientRect();
-          this.mTabstrip._calcTabMargins(aTab);
+          if (!Tabmix.isVersion(570)) {
+            this.mTabstrip._calcTabMargins(aTab);
+          }
 
           // DOMRect left/right properties are immutable.
           tab = {left: tab.left, right: tab.right, top: tab.top, bottom: tab.bottom};
@@ -390,7 +394,7 @@
             let selected = !this.selectedItem.pinned &&
                            this.selectedItem.getBoundingClientRect();
 
-            if (Tabmix.isVersion(310) && !TabmixTabbar.isMultiRow) {
+            if (!Tabmix.isVersion(570) && Tabmix.isVersion(310) && !TabmixTabbar.isMultiRow) {
               if (selected) {
                 selected = {left: selected.left, right: selected.right};
                 // Need to take in to account the width of the left/right margins on tabs.
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 2e3d72f..3e44bfd 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1181,6 +1181,9 @@ var TMP_eventListener = {
     }
     updateAttrib("class", "tab-icon-image", "role", "presentation");
     updateAttrib("class", "tab-text", "role", "presentation");
+    if (Tabmix.isVersion(570)) {
+      updateAttrib("class", "tab-background", "orient", "vertical");
+    }
   }
 
 };
diff --git a/chrome/skin/app_version/41.0/win/browser.css b/chrome/skin/app_version/41.0/win/browser.css
index 04e9275..0b301f3 100644
--- a/chrome/skin/app_version/41.0/win/browser.css
+++ b/chrome/skin/app_version/41.0/win/browser.css
@@ -34,3 +34,8 @@ Windows platform
   box-shadow: none !important;
 }
 
+/* for Firefox 57 style */
+.tabbrowser-tabs:not([tabmix_australis="true"]):not([treestyletab-mode="vertical"])
+    > .tabbrowser-tab > .tab-stack > .tab-progress-container > .tab-progress {
+  margin: 1px;
+}

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