Commit b554ceb6 authored by ariasuni's avatar ariasuni
Browse files

Fix tabs shrinking animation triggered at startup

parent 0cff636c
Pipeline #316467 passed with stages
in 1 minute and 42 seconds
......@@ -52,7 +52,7 @@ export default class Sidebar {
await this._initPrefs();
this._tablist = new Tablist(this);
this._onStorageChanged(this.prefs);
this._onStorageChanged(this.prefs, true);
browser.runtime.connect({ name: this.windowId.toString() });
this._setupListeners();
......@@ -134,11 +134,10 @@ export default class Sidebar {
if (typeof prefs.compactMode === "string") {
prefs.compactMode = parseInt(prefs.compactMode);
}
return prefs;
}
_onStorageChanged(changes) {
_onStorageChanged(changes, firstTime) {
// merge prefs
if (changes.hasOwnProperty("compactMode")) {
changes.compactMode = parseInt(changes.compactMode);
......@@ -155,8 +154,8 @@ export default class Sidebar {
if (changes.hasOwnProperty("themeIntegration")) {
this._applyTheme(this._theme);
}
if (changes.hasOwnProperty("animations")) {
document.body.classList.toggle("animated", this._animations);
if (changes.hasOwnProperty("animations") && !firstTime) {
document.body.classList.toggle("animated", this.prefs._animations);
}
if (changes.hasOwnProperty("compactPins")) {
......
......@@ -631,7 +631,7 @@ export default class Tablist {
return url.hostname;
} else {
// about:, file:///, chrome://, data:, chrome://, moz-extension://, resource://, view-source:
// Used rarely so mostly likely only protocol is useful for filtering
// Used rarely so most likely only protocol is useful for filtering
return url_string.match(/^[\w-]*:\/*/)[0];
}
}
......@@ -812,14 +812,19 @@ export default class Tablist {
}
this._pinnedview.appendChild(pinnedFragment);
this._view.insertBefore(unpinnedFragment, this._bottomVisibilityChecker);
document.body.classList.add("loaded");
this._maybeShrinkTabs(true);
if (activeTab !== null) {
this.scrollIntoView(activeTab);
this._maybeUpdateTabThumbnail(activeTab);
}
this._initCanScrollShadowObservers();
setTimeout(() => document.body.classList.toggle("animated", this._prefs.animations), 30);
requestAnimationFrame(() => {
document.body.classList.add("loaded");
requestAnimationFrame(() => {
document.body.classList.toggle("animated", this._prefs.animations);
});
});
}
checkWindow(windowId) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment