From da7a3942421a5c90f1a42fe8a54c97edda826439 Mon Sep 17 00:00:00 2001 From: Natalia Csoregi Date: Wed, 25 Oct 2023 23:16:00 +0300 Subject: [PATCH] Backed out changeset ce62de041fca (bug 1860041) for causing failures on test_focus_display_none_xorigin_iframe.html. CLOSED TREE --- dom/base/nsFrameLoader.cpp | 19 +++++++++++++++++++ dom/base/nsFrameLoader.h | 2 ++ dom/base/nsFrameLoaderOwner.cpp | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 3559b4c664e6..f6c7b279638f 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -2452,6 +2452,25 @@ nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) { return NS_OK; } +void nsFrameLoader::PropagateIsUnderHiddenEmbedderElement( + bool aIsUnderHiddenEmbedderElement) { + bool isUnderHiddenEmbedderElement = true; + if (Document* ownerDoc = GetOwnerDoc()) { + if (PresShell* presShell = ownerDoc->GetPresShell()) { + isUnderHiddenEmbedderElement = presShell->IsUnderHiddenEmbedderElement(); + } + } + + isUnderHiddenEmbedderElement |= aIsUnderHiddenEmbedderElement; + + BrowsingContext* browsingContext = GetExtantBrowsingContext(); + if (browsingContext && browsingContext->IsUnderHiddenEmbedderElement() != + isUnderHiddenEmbedderElement) { + Unused << browsingContext->SetIsUnderHiddenEmbedderElement( + isUnderHiddenEmbedderElement); + } +} + void nsFrameLoader::UpdateRemoteStyle( mozilla::StyleImageRendering aImageRendering) { MOZ_DIAGNOSTIC_ASSERT(IsRemoteFrame()); diff --git a/dom/base/nsFrameLoader.h b/dom/base/nsFrameLoader.h index d783ebae1c22..159e3865a611 100644 --- a/dom/base/nsFrameLoader.h +++ b/dom/base/nsFrameLoader.h @@ -154,6 +154,8 @@ class nsFrameLoader final : public nsStubMutationObserver, return mChildMessageManager; } nsresult UpdatePositionAndSize(nsSubDocumentFrame* aIFrame); + void PropagateIsUnderHiddenEmbedderElement( + bool aIsUnderHiddenEmbedderElement); void UpdateRemoteStyle(mozilla::StyleImageRendering aImageRendering); diff --git a/dom/base/nsFrameLoaderOwner.cpp b/dom/base/nsFrameLoaderOwner.cpp index aaa1ad38e767..03945975dd01 100644 --- a/dom/base/nsFrameLoaderOwner.cpp +++ b/dom/base/nsFrameLoaderOwner.cpp @@ -220,6 +220,12 @@ void nsFrameLoaderOwner::ChangeFrameLoaderCommon(Element* aOwner, *aOwner, u"XULFrameLoaderCreated"_ns, mozilla::CanBubble::eYes, mozilla::ChromeOnlyDispatch::eYes); } + + if (mFrameLoader) { + mFrameLoader->PropagateIsUnderHiddenEmbedderElement( + !aOwner->GetPrimaryFrame() || + !aOwner->GetPrimaryFrame()->StyleVisibility()->IsVisible()); + } } void nsFrameLoaderOwner::UpdateFocusAndMouseEnterStateAfterFrameLoaderChange() {