From 442f4b48e6b3a96a918d206dde543c4476a84a12 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 6 May 2011 14:29:39 +0900 Subject: [PATCH] * Pinned tabs in the rightside tab bar were unexpectedly animated. (fix for https://github.com/piroor/treestyletab/issues/95 ) * Pinned tabs were not animated anymore. (regression) --- content/treestyletab/treestyletab.css | 30 +++++---------------- content/treestyletab/treestyletabbrowser.js | 18 ++++++++++--- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index d2fca178..f6eabbce 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -319,36 +319,20 @@ toolbar.treestyletab-tabbar-toolbar-ready:not([nowindowdrag="true"]), /* animation effects */ -.tabbrowser-tabs[treestyletab-animation-enabled="true"][treestyletab-mode="vertical"]:not([treestyletab-tab-inverted="true"]) +.tabbrowser-tabs[treestyletab-animation-enabled="true"][treestyletab-mode="vertical"] .tabbrowser-tab:not([treestyletab-collapsed-done="true"]) { - -moz-transition: margin-top 0.15s ease-out, - opacity 0.15s ease-out, - margin-left 0.2s ease-out, - min-height 0.15s ease-out, - max-height 0.15s ease-out, - min-width 0.15s ease-out /* for Firefox itself */, - max-width 0.15s ease-out /* for Firefox itself */; - transition: margin-top 0.15s ease-out, - opacity 0.15s ease-out, - margin-left 0.2s ease-out, - min-height 0.15s ease-out, - max-height 0.15s ease-out, - min-width 0.15s ease-out /* for Firefox itself */, - max-width 0.15s ease-out /* for Firefox itself */; -} - -.tabbrowser-tabs[treestyletab-animation-enabled="true"][treestyletab-mode="vertical"][treestyletab-tab-inverted="true"] - .tabbrowser-tab:not([treestyletab-collapsed-done="true"]) { - -moz-transition: margin-top 0.15s ease-out, - opacity 0.15s ease-out, + -moz-transition: margin-left 0.2s ease-out, margin-right 0.2s ease-out, + margin-top 0.15s ease-out, + opacity 0.15s ease-out, min-height 0.15s ease-out, max-height 0.15s ease-out, min-width 0.15s ease-out /* for Firefox itself */, max-width 0.15s ease-out /* for Firefox itself */; - transition: margin-top 0.15s ease-out, - opacity 0.15s ease-out, + transition: margin-left 0.2s ease-out, margin-right 0.2s ease-out, + margin-top 0.15s ease-out, + opacity 0.15s ease-out, min-height 0.15s ease-out, max-height 0.15s ease-out, min-width 0.15s ease-out /* for Firefox itself */, diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 4389e7c5..f18a1d93 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -302,7 +302,7 @@ TreeStyleTabBrowser.prototype = { return false; }, - positionPinnedTabs : function TSTBrowser_positionPinnedTabs(aWidth, aHeight) + positionPinnedTabs : function TSTBrowser_positionPinnedTabs(aWidth, aHeight, aJustNow) { var b = this.mTabBrowser; var tabbar = b.tabContainer; @@ -344,6 +344,11 @@ TreeStyleTabBrowser.prototype = { { let style = tabbar.childNodes[i].style; style.MozMarginStart = ''; + + let transitionStyleBackup = style.transition || style.MozTransition || ''; + if (aJustNow) + style.MozTransition = style.transition = 'none'; + if (inverted) { /** * In a box with "direction: rtr", we have to position tabs @@ -358,8 +363,15 @@ TreeStyleTabBrowser.prototype = { style.setProperty('margin-left', ((width * col) + shrunkenOffset)+'px', 'important'); style.marginRight = ''; } + style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important'); style.top = style.right = style.bottom = style.left = ''; + + if (aJustNow) + this.Deferred.next(function() { // "transition" must be cleared after the reflow. + style.MozTransition = style.transition = transitionStyleBackup; + }); + col++; if (col >= maxCol) { col = 0; @@ -1511,7 +1523,7 @@ TreeStyleTabBrowser.prototype = { this._updateFloatingTabbarReason |= aReason; if (this._updateFloatingTabbarReason & this.kTABBAR_UPDATE_NOW) { - this._updateFloatingTabbarInternal(this.updateFloatingTabbarReason); + this._updateFloatingTabbarInternal(this._updateFloatingTabbarReason); this._updateFloatingTabbarReason = 0; } else { @@ -1623,7 +1635,7 @@ TreeStyleTabBrowser.prototype = { this.mTabBrowser.tabContainer.removeAttribute('context'); } - this.positionPinnedTabs(); + this.positionPinnedTabs(null, null, aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE); }, _updateFloatingTabbarResizer : function TSTBrowser_updateFloatingTabbarResizer(aSize)