Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=kmag
A new `BrowsingContext` field has been added to track the active browser window for the `:-moz-window-inactive` pseudoclass. This field takes the place of `nsPIDOMWindowOuter::mIsActive`. With this change `:-moz-window-inactive` is now fission compatible. Differential Revision: https://phabricator.services.mozilla.com/D86422
This commit is contained in:
@@ -263,12 +263,18 @@ CanonicalBrowsingContext::GetParentCrossChromeBoundary() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Nullable<WindowProxyHolder> CanonicalBrowsingContext::GetTopChromeWindow() {
|
||||
already_AddRefed<CanonicalBrowsingContext>
|
||||
CanonicalBrowsingContext::TopCrossChromeBoundary() {
|
||||
RefPtr<CanonicalBrowsingContext> bc(this);
|
||||
while (RefPtr<CanonicalBrowsingContext> parent =
|
||||
bc->GetParentCrossChromeBoundary()) {
|
||||
bc = parent.forget();
|
||||
}
|
||||
return bc.forget();
|
||||
}
|
||||
|
||||
Nullable<WindowProxyHolder> CanonicalBrowsingContext::GetTopChromeWindow() {
|
||||
RefPtr<CanonicalBrowsingContext> bc = TopCrossChromeBoundary();
|
||||
if (bc->IsChrome()) {
|
||||
return WindowProxyHolder(bc.forget());
|
||||
}
|
||||
@@ -428,6 +434,34 @@ CanonicalBrowsingContext::ReplaceLoadingSessionHistoryEntryForLoad(
|
||||
return MakeUnique<LoadingSessionHistoryInfo>(newEntry, aInfo->mLoadId);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::CallOnAllTopDescendants(
|
||||
const std::function<mozilla::CallState(CanonicalBrowsingContext*)>&
|
||||
aCallback) {
|
||||
#ifdef DEBUG
|
||||
RefPtr<CanonicalBrowsingContext> parent = GetParentCrossChromeBoundary();
|
||||
MOZ_ASSERT(!parent, "Should only call on top chrome BC");
|
||||
#endif
|
||||
|
||||
nsTArray<RefPtr<BrowsingContextGroup>> groups;
|
||||
BrowsingContextGroup::GetAllGroups(groups);
|
||||
for (auto& browsingContextGroup : groups) {
|
||||
for (auto& bc : browsingContextGroup->Toplevels()) {
|
||||
if (bc == this) {
|
||||
// Cannot be a descendent of myself so skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
RefPtr<CanonicalBrowsingContext> top =
|
||||
bc->Canonical()->TopCrossChromeBoundary();
|
||||
if (top == this) {
|
||||
if (aCallback(bc->Canonical()) == CallState::Stop) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::SessionHistoryCommit(uint64_t aLoadId,
|
||||
const nsID& aChangeID,
|
||||
uint32_t aLoadType) {
|
||||
|
||||
Reference in New Issue
Block a user