зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1397426 - Expose renderLayers state via nsITabParent and correctly set initial tab states in async tab switcher. r=billm
MozReview-Commit-ID: IIMmwrgJUV6 --HG-- extra : rebase_source : 00ca04b970feb98d96b082c9b582875d486d2ece
This commit is contained in:
Родитель
3d0b1bf4e8
Коммит
5b0d6be3e2
|
@ -4389,7 +4389,7 @@
|
|||
}
|
||||
|
||||
if (tabParent) {
|
||||
tabParent.renderLayers(true);
|
||||
browser.renderLayers = true;
|
||||
} else {
|
||||
this.onLayersReady(browser);
|
||||
}
|
||||
|
@ -4436,21 +4436,30 @@
|
|||
window.addEventListener("SwapDocShells", this, true);
|
||||
window.addEventListener("EndSwapDocShells", this, true);
|
||||
|
||||
let tab = this.requestedTab;
|
||||
let browser = tab.linkedBrowser;
|
||||
let tabIsLoaded = browser.renderingLayers;
|
||||
let initialTab = this.requestedTab;
|
||||
|
||||
if (!this.minimizedOrFullyOccluded) {
|
||||
this.log("Initial tab is loaded?: " + tabIsLoaded);
|
||||
this.setTabState(tab, tabIsLoaded ? this.STATE_LOADED
|
||||
: this.STATE_LOADING);
|
||||
}
|
||||
for (let ppBrowser of this.tabbrowser._printPreviewBrowsers) {
|
||||
let ppTab = this.tabbrowser.getTabForBrowser(ppBrowser);
|
||||
let state = ppBrowser.hasLayers ? this.STATE_LOADED
|
||||
: this.STATE_LOADING;
|
||||
this.setTabState(ppTab, state);
|
||||
for (let tab of this.tabbrowser.tabs) {
|
||||
if (tab == initialTab && this.minimizedOrFullyOccluded) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tab.linkedPanel) {
|
||||
let b = tab.linkedBrowser;
|
||||
let state;
|
||||
if (b.renderLayers && b.hasLayers) {
|
||||
state = this.STATE_LOADED;
|
||||
} else if (b.renderLayers && !b.hasLayers) {
|
||||
state = this.STATE_LOADING;
|
||||
} else if (!b.renderLayers && b.hasLayers) {
|
||||
state = this.STATE_UNLOADING;
|
||||
} else {
|
||||
state = this.STATE_UNLOADED;
|
||||
}
|
||||
|
||||
this.setTabState(tab, state);
|
||||
}
|
||||
}
|
||||
this.logState("Tab states initialized");
|
||||
},
|
||||
|
||||
destroy() {
|
||||
|
|
|
@ -25,12 +25,11 @@ interface nsITabParent : nsISupports
|
|||
attribute boolean docShellIsActive;
|
||||
|
||||
/**
|
||||
* When aEnabled is set to true, this tells the child to paint and
|
||||
* upload layers to the compositor. When aEnabled is set to false,
|
||||
* previous layers are cleared from the compositor, but only if
|
||||
* preserveLayers is also set to false.
|
||||
* When set to true, this tells the child to paint and upload layers to
|
||||
* the compositor. When set to false, previous layers are cleared from
|
||||
* the compositor, but only if preserveLayers is also set to false.
|
||||
*/
|
||||
void renderLayers(in bool aEnabled);
|
||||
attribute boolean renderLayers;
|
||||
|
||||
/**
|
||||
* True if layers are being rendered and the compositor has reported
|
||||
|
|
|
@ -2907,7 +2907,7 @@ TabParent::SetDocShellIsActive(bool isActive)
|
|||
// docshell is consider prerendered only if not active yet
|
||||
mIsPrerendered &= !isActive;
|
||||
mDocShellIsActive = isActive;
|
||||
RenderLayers(isActive);
|
||||
SetRenderLayers(isActive);
|
||||
Unused << SendSetDocShellIsActive(isActive);
|
||||
|
||||
// update active accessible documents on windows
|
||||
|
@ -2949,7 +2949,7 @@ TabParent::GetIsPrerendered(bool* aIsPrerendered)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::RenderLayers(bool aEnabled)
|
||||
TabParent::SetRenderLayers(bool aEnabled)
|
||||
{
|
||||
if (aEnabled == mRenderLayers) {
|
||||
if (aEnabled == mHasLayers && mPreserveLayers) {
|
||||
|
@ -2995,6 +2995,13 @@ TabParent::RenderLayers(bool aEnabled)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetRenderLayers(bool* aResult)
|
||||
{
|
||||
*aResult = mRenderLayers;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetHasLayers(bool* aResult)
|
||||
{
|
||||
|
|
|
@ -304,6 +304,19 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<property name="renderLayers">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.docShellIsActive;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
return this.docShellIsActive = val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="hasLayers" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
|
|
@ -258,6 +258,27 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="renderLayers">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
let {frameLoader} = this;
|
||||
if (frameLoader && frameLoader.tabParent) {
|
||||
return frameLoader.tabParent.renderLayers;
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
let {frameLoader} = this;
|
||||
if (frameLoader && frameLoader.tabParent) {
|
||||
return frameLoader.tabParent.renderLayers = val;
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="hasLayers" readonly="true">
|
||||
<getter><![CDATA[
|
||||
let {frameLoader} = this;
|
||||
|
|
Загрузка…
Ссылка в новой задаче