Skip to content

Commit

Permalink
Show newly opened tab immediately.
Browse files Browse the repository at this point in the history
See also: #1202
  • Loading branch information
piroor committed Oct 12, 2016
1 parent 3bcd07d commit 23843af
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions modules/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6786,11 +6786,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
}
}

var startMargin, endMargin, startOpacity, endOpacity;
var startMargin, endMargin, endOpacity;
var startOpacity = this.window.getComputedStyle(aTab).opacity;
if (aCollapsed) {
startMargin = 0;
endMargin = maxMargin;
startOpacity = 1;
endOpacity = 0;
if (this.canStackTabs && this.getParentTab(aTab)) {
endOpacity = 1;
Expand All @@ -6800,7 +6800,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
else {
startMargin = maxMargin;
endMargin = 0;
startOpacity = 0;
startOpacoty = 0;

This comment has been minimized.

Copy link
@hiikezoe

hiikezoe Oct 14, 2016

Opacoty...

This comment has been minimized.

Copy link
@piroor

piroor Oct 14, 2016

Author Owner

後のコミットで直したので見逃して下さい……!

This comment has been minimized.

Copy link
@ashie

ashie Oct 14, 2016

💩

endOpacity = 1;
if (this.canStackTabs && this.getParentTab(aTab)) {
startOpacity = 1;
Expand Down Expand Up @@ -6831,9 +6831,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
aTab.style.setProperty(this.collapseCSSProp, endMargin ? '-'+endMargin+'px' : '', 'important');

if (endOpacity == 0)
aTab.style.setProperty('opacity', 0, 'important');
else
aTab.style.removeProperty('opacity');
aTab.style.setProperty('opacity', endOpacity, 'important');

if (aCallbackToRunOnStartAnimation)
aCallbackToRunOnStartAnimation();
Expand All @@ -6844,7 +6842,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
var deltaOpacity = endOpacity - startOpacity;

aTab.style.setProperty(this.collapseCSSProp, startMargin ? '-'+startMargin+'px' : '', 'important');
aTab.style.setProperty('opacity', startOpacity == 1 ? '' : startOpacity, 'important');
aTab.style.setProperty('opacity', startOpacity, 'important');

if (!aCollapsed) {
aTab.setAttribute(offsetAttr, maxMargin);
Expand All @@ -6862,7 +6860,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
if (aCallbackToRunOnStartAnimation)
aCallbackToRunOnStartAnimation();
aTab.style.setProperty(self.collapseCSSProp, endMargin ? '-'+endMargin+'px' : '', 'important');
aTab.style.setProperty('opacity', endOpacity == 1 ? '' : endOpacity, 'important');
aTab.style.setProperty('opacity', endOpacity, 'important');
}
firstFrame = false;
// If this is the last tab, negative scroll happens.
Expand All @@ -6886,6 +6884,25 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
aTab.removeAttribute(offsetAttr);
aTab.removeAttribute(self.kCOLLAPSING_PHASE);

if (endOpacity > 0) {
if (self.window.getComputedStyle(aTab).opacity > 0) {
aTab.style.opacity = '';
aTab = null;
}
else {
// If we clear its "opacity" before it becomes "1"
// by CSS transition, the calculated opacity will
// become 0 after we set an invalid value to clear it.
// So we have to clear it with delay.
// This is workaround for the issue:
// https://github.com/piroor/treestyletab/issues/1202
setTimeout(function() {
aTab.style.opacity = '';
aTab = null;
}, 0);
}
}

maxMargin = null;
offsetAttr = null;
startMargin = null;
Expand All @@ -6897,7 +6914,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
collapseProp = null;
radian = null;
self = null;
aTab = null;

return true;
}
Expand Down

0 comments on commit 23843af

Please sign in to comment.