Bug 1717983 - Don't consider a browser active if the tab is inactive but we're preserving layers. r=nika

GeckoView always calls preserveLayers(true) on all <browser> elements,
which causes the puppet widget to always be considered visible.

Given how the code worked before, aBrowsingContext.isActive = false
after that call would deactivate the pres shell, but after my patch it
stops doing so.

We don't really want to un-throttle the refresh driver etc just because
we're preserving layers, so propagate the state to the child process and
account for that in the logic to determine PresShell activeness.

Depends on D118703

Differential Revision: https://phabricator.services.mozilla.com/D118884
This commit is contained in:
Emilio Cobos Álvarez
2021-07-05 17:31:49 +00:00
parent 1af5e8922e
commit f17f9753e7
6 changed files with 63 additions and 29 deletions

View File

@@ -10797,7 +10797,16 @@ bool PresShell::ShouldBeActive() const {
// throttling code (in-process throttling for non-visible iframes lives
// right now in Document::ShouldThrottleFrameRequests(), but that only
// throttles rAF).
return browserChild->IsVisible();
if (!browserChild->IsVisible()) {
return false;
}
// If the browser is visible but just due to be preserving layers
// artificially, we do want to fall back to the browsing context activeness
// instead. Otherwise we do want to be active for the use cases above.
if (!browserChild->IsPreservingLayers()) {
return true;
}
}
BrowsingContext* bc = doc->GetBrowsingContext();