Bug 1927255 - More subtly deal with preserveLayers in inactive tabs. r=mconley

PreserveLayers is propagated to child frames, and it'd be nice if it
could be used just the same way it's used for the top level tab, to
avoid discarding the resources.

For the top level, if you call preserveLayers() you also need to have
renderLayers = true.

It'd be better long-term, perhaps, to have renderLayers and
preserveLayers in the parent BC. Happy to work on that refactoring if
you agree.

Testing wise, I don't think this is easily testable...

Differential Revision: https://phabricator.services.mozilla.com/D227000
This commit is contained in:
Emilio Cobos Álvarez
2024-10-30 00:42:23 +00:00
parent 995a3b1088
commit 0642354b62
3 changed files with 27 additions and 16 deletions

View File

@@ -2750,6 +2750,9 @@ void BrowsingContext::DidSet(FieldIndex<IDX_ExplicitActive>,
PreOrderWalk([&](BrowsingContext* aContext) {
if (nsCOMPtr<nsIDocShell> ds = aContext->GetDocShell()) {
if (auto* bc = BrowserChild::GetFrom(ds)) {
bc->UpdateVisibility();
}
nsDocShell::Cast(ds)->ActivenessMaybeChanged();
}
});