mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-15 14:26:12 +00:00
feat: Improve startup time and reduce initial animations, b=bug #6997, c=common, workspaces
This commit is contained in:
@@ -37,7 +37,7 @@ export var ZenCustomizableUI = new (class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_addSidebarButtons(window) {
|
_addSidebarButtons(window) {
|
||||||
const kDefaultSidebarWidth = '228px';
|
const kDefaultSidebarWidth = '210px';
|
||||||
const toolbox = window.gNavToolbox;
|
const toolbox = window.gNavToolbox;
|
||||||
|
|
||||||
// Set a splitter to navigator-toolbox
|
// Set a splitter to navigator-toolbox
|
||||||
|
@@ -2,12 +2,14 @@
|
|||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
{
|
{
|
||||||
var ZenStartup = {
|
var gZenStartup = {
|
||||||
_watermarkIgnoreElements: ['zen-toast-container'],
|
_watermarkIgnoreElements: ['zen-toast-container'],
|
||||||
|
|
||||||
async init() {
|
isReady: false,
|
||||||
|
|
||||||
|
init() {
|
||||||
this.openWatermark();
|
this.openWatermark();
|
||||||
await this._initBrowserBackground();
|
this._initBrowserBackground();
|
||||||
this._changeSidebarLocation();
|
this._changeSidebarLocation();
|
||||||
this._zenInitBrowserLayout();
|
this._zenInitBrowserLayout();
|
||||||
},
|
},
|
||||||
@@ -21,7 +23,7 @@
|
|||||||
document.getElementById('browser').prepend(background);
|
document.getElementById('browser').prepend(background);
|
||||||
},
|
},
|
||||||
|
|
||||||
async _zenInitBrowserLayout() {
|
_zenInitBrowserLayout() {
|
||||||
if (this.__hasInitBrowserLayout) return;
|
if (this.__hasInitBrowserLayout) return;
|
||||||
this.__hasInitBrowserLayout = true;
|
this.__hasInitBrowserLayout = true;
|
||||||
try {
|
try {
|
||||||
@@ -42,7 +44,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
gZenWorkspaces.init();
|
gZenWorkspaces.init();
|
||||||
gZenUIManager.init();
|
setTimeout(() => {
|
||||||
|
gZenUIManager.init();
|
||||||
|
}, 0);
|
||||||
|
|
||||||
this._checkForWelcomePage();
|
this._checkForWelcomePage();
|
||||||
|
|
||||||
@@ -75,21 +79,16 @@
|
|||||||
await SessionStore.promiseAllWindowsRestored;
|
await SessionStore.promiseAllWindowsRestored;
|
||||||
delete gZenUIManager.promiseInitialized;
|
delete gZenUIManager.promiseInitialized;
|
||||||
this._initSearchBar();
|
this._initSearchBar();
|
||||||
setTimeout(() => {
|
gZenCompactModeManager.init();
|
||||||
gZenCompactModeManager.init();
|
// Fix for https://github.com/zen-browser/desktop/issues/7605, specially in compact mode
|
||||||
setTimeout(() => {
|
if (gURLBar.hasAttribute('breakout-extend')) {
|
||||||
// Fix for https://github.com/zen-browser/desktop/issues/7605, specially in compact mode
|
gURLBar.focus();
|
||||||
if (gURLBar.hasAttribute('breakout-extend')) {
|
}
|
||||||
gURLBar.focus();
|
// A bit of a hack to make sure the tabs toolbar is updated.
|
||||||
}
|
// Just in case we didn't get the right size.
|
||||||
setTimeout(() => {
|
gZenUIManager.updateTabsToolbar();
|
||||||
// A bit of a hack to make sure the tabs toolbar is updated.
|
|
||||||
// Just in case we didn't get the right size.
|
|
||||||
gZenUIManager.updateTabsToolbar();
|
|
||||||
}, 0);
|
|
||||||
}, 100);
|
|
||||||
}, 0);
|
|
||||||
this.closeWatermark();
|
this.closeWatermark();
|
||||||
|
this.isReady = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -114,8 +113,7 @@
|
|||||||
opacity: [0, 1],
|
opacity: [0, 1],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
delay: 0.6,
|
duration: 0.1,
|
||||||
easing: 'ease-in-out',
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -165,7 +163,7 @@
|
|||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
'MozBeforeInitialXULLayout',
|
'MozBeforeInitialXULLayout',
|
||||||
() => {
|
() => {
|
||||||
ZenStartup.init();
|
gZenStartup.init();
|
||||||
},
|
},
|
||||||
{ once: true }
|
{ once: true }
|
||||||
);
|
);
|
||||||
|
@@ -549,7 +549,8 @@ var gZenVerticalTabsManager = {
|
|||||||
!aTab ||
|
!aTab ||
|
||||||
!gZenUIManager._hasLoadedDOM ||
|
!gZenUIManager._hasLoadedDOM ||
|
||||||
!aTab.isConnected ||
|
!aTab.isConnected ||
|
||||||
gZenUIManager.testingEnabled
|
gZenUIManager.testingEnabled ||
|
||||||
|
!gZenStartup.isReady
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
<toolbarbutton class="toolbarbutton-1 chromeclass-toolbar-additional zen-workspaces-actions" context="zenWorkspaceMoreActions"></toolbarbutton>
|
<toolbarbutton class="toolbarbutton-1 chromeclass-toolbar-additional zen-workspaces-actions" context="zenWorkspaceMoreActions"></toolbarbutton>
|
||||||
</vbox>
|
</vbox>
|
||||||
<arrowscrollbox orient="vertical" class="workspace-arrowscrollbox">
|
<arrowscrollbox orient="vertical" class="workspace-arrowscrollbox">
|
||||||
<vbox class="zen-workspace-tabs-section zen-workspace-pinned-tabs-section">
|
<vbox class="zen-workspace-tabs-section zen-workspace-pinned-tabs-section" hide-separator="true">
|
||||||
<html:div class="pinned-tabs-container-separator"></html:div>
|
<html:div class="pinned-tabs-container-separator"></html:div>
|
||||||
</vbox>
|
</vbox>
|
||||||
<vbox class="zen-workspace-tabs-section zen-workspace-normal-tabs-section">
|
<vbox class="zen-workspace-tabs-section zen-workspace-normal-tabs-section">
|
||||||
|
@@ -1606,7 +1606,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
|||||||
) {
|
) {
|
||||||
delete this._alwaysAnimatePaddingTop;
|
delete this._alwaysAnimatePaddingTop;
|
||||||
const essentialsHeight = essentialContainer.getBoundingClientRect().height;
|
const essentialsHeight = essentialContainer.getBoundingClientRect().height;
|
||||||
if (!forAnimation && animateContainer && gZenUIManager.motion) {
|
if (!forAnimation && animateContainer && gZenUIManager.motion && gZenStartup.isReady) {
|
||||||
gZenUIManager.motion.animate(
|
gZenUIManager.motion.animate(
|
||||||
workspaceElement,
|
workspaceElement,
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,7 @@ export default [
|
|||||||
|
|
||||||
'gZenUIManager',
|
'gZenUIManager',
|
||||||
'gZenVerticalTabsManager',
|
'gZenVerticalTabsManager',
|
||||||
|
'gZenStartup',
|
||||||
|
|
||||||
'gZenWorkspaces',
|
'gZenWorkspaces',
|
||||||
'ZenWorkspacesEngine',
|
'ZenWorkspacesEngine',
|
||||||
|
Reference in New Issue
Block a user