diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index f31b7c860ebf..6a6fd732e3ff 100644 --- a/dom/base/DOMIntersectionObserver.cpp +++ b/dom/base/DOMIntersectionObserver.cpp @@ -449,7 +449,8 @@ struct OopIframeMetrics { static Maybe GetOopIframeMetrics(Document& aDocument, Document* aRootDocument) { - Document* rootDoc = nsContentUtils::GetRootDocument(&aDocument); + Document* rootDoc = + nsContentUtils::GetInProcessSubtreeRootDocument(&aDocument); MOZ_ASSERT(rootDoc); if (rootDoc->IsTopLevelContentDocument()) { @@ -457,7 +458,8 @@ static Maybe GetOopIframeMetrics(Document& aDocument, } if (aRootDocument && - rootDoc == nsContentUtils::GetRootDocument(aRootDocument)) { + rootDoc == + nsContentUtils::GetInProcessSubtreeRootDocument(aRootDocument)) { // aRootDoc, if non-null, is either the implicit root // (top-level-content-document) or a same-origin document passed explicitly. // diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 82836d20b03c..b5540410587a 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -13696,7 +13696,8 @@ bool FullscreenRoots::Contains(Document* aRoot) { /* static */ void FullscreenRoots::Add(Document* aDoc) { - nsCOMPtr root = nsContentUtils::GetRootDocument(aDoc); + nsCOMPtr root = + nsContentUtils::GetInProcessSubtreeRootDocument(aDoc); if (!FullscreenRoots::Contains(root)) { if (!sInstance) { sInstance = new FullscreenRoots(); @@ -13722,7 +13723,8 @@ uint32_t FullscreenRoots::Find(Document* aRoot) { /* static */ void FullscreenRoots::Remove(Document* aDoc) { - nsCOMPtr root = nsContentUtils::GetRootDocument(aDoc); + nsCOMPtr root = + nsContentUtils::GetInProcessSubtreeRootDocument(aDoc); uint32_t index = Find(root); NS_ASSERTION(index != NotFound, "Should only try to remove roots which are still added!"); @@ -13972,7 +13974,7 @@ static Document* GetFullscreenLeaf(Document* aDoc) { } // Otherwise we could be either in a non-fullscreen doc tree, or we're // below the fullscreen doc. Start the search from the root. - Document* root = nsContentUtils::GetRootDocument(aDoc); + Document* root = nsContentUtils::GetInProcessSubtreeRootDocument(aDoc); return GetFullscreenLeaf(*root); } @@ -14632,8 +14634,9 @@ void Document::RequestFullscreenInContentProcess( // If we are in the content process, we can apply the fullscreen // state directly only if we have been in DOM fullscreen, because // otherwise we always need to notify the chrome. - if (applyFullScreenDirectly || !!nsContentUtils::GetRootDocument(this) - ->GetUnretargetedFullScreenElement()) { + if (applyFullScreenDirectly || + !!nsContentUtils::GetInProcessSubtreeRootDocument(this) + ->GetUnretargetedFullScreenElement()) { ApplyFullscreen(std::move(aRequest)); return; } @@ -14730,7 +14733,8 @@ bool Document::ApplyFullscreen(UniquePtr aRequest) { // Remember the root document, so that if a fullscreen document is hidden // we can reset fullscreen state in the remaining visible fullscreen // documents. - Document* fullScreenRootDoc = nsContentUtils::GetRootDocument(this); + Document* fullScreenRootDoc = + nsContentUtils::GetInProcessSubtreeRootDocument(this); // If a document is already in fullscreen, then unlock the mouse pointer // before setting a new document to fullscreen diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 1e7859058750..5d57f9795483 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -6944,7 +6944,7 @@ void nsContentUtils::FireMutationEventsForDirectParsing( } /* static */ -Document* nsContentUtils::GetRootDocument(Document* aDoc) { +Document* nsContentUtils::GetInProcessSubtreeRootDocument(Document* aDoc) { if (!aDoc) { return nullptr; } diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 39932a36a9a4..a95499738ddd 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2446,10 +2446,10 @@ class nsContentUtils { static bool HasPluginWithUncontrolledEventDispatch(nsIContent* aContent); /** - * Returns the root document in a document hierarchy. Normally this - * will be the chrome document. + * Returns the in-process subtree root document in a document hierarchy. + * This could be a chrome document. */ - static Document* GetRootDocument(Document* aDoc); + static Document* GetInProcessSubtreeRootDocument(Document* aDoc); static void GetShiftText(nsAString& text); static void GetControlText(nsAString& text); diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index d8ebc56d7a91..b9ded5d1c25a 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1641,7 +1641,8 @@ void nsFocusManager::SetFocusInner(Element* aNewContent, int32_t aFlags, // to guard against phishing. #ifndef XP_MACOSX if (elementToFocus && - nsContentUtils::GetRootDocument(elementToFocus->OwnerDoc()) + nsContentUtils::GetInProcessSubtreeRootDocument( + elementToFocus->OwnerDoc()) ->GetFullscreenElement() && nsContentUtils::HasPluginWithUncontrolledEventDispatch(elementToFocus)) { nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, "DOM"_ns, diff --git a/layout/base/GeometryUtils.cpp b/layout/base/GeometryUtils.cpp index 04688717b3f0..aadd3f8330a6 100644 --- a/layout/base/GeometryUtils.cpp +++ b/layout/base/GeometryUtils.cpp @@ -327,7 +327,7 @@ void GetBoxQuadsFromWindowOrigin(nsINode* aNode, BoxQuadOptions bqo(aOptions); RefPtr topInProcessDoc = - nsContentUtils::GetRootDocument(aNode->OwnerDoc()); + nsContentUtils::GetInProcessSubtreeRootDocument(aNode->OwnerDoc()); OwningGeometryNode ogn; ogn.SetAsDocument() = topInProcessDoc; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 05d899547c5c..2774b16d534e 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -8412,7 +8412,7 @@ void PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch( Document* doc = mPresShell->GetCurrentEventContent() ? mPresShell->mCurrentEventContent->OwnerDoc() : nullptr; - Document* root = nsContentUtils::GetRootDocument(doc); + Document* root = nsContentUtils::GetInProcessSubtreeRootDocument(doc); if (root && root->GetFullscreenElement()) { // Prevent default action on ESC key press when exiting // DOM fullscreen mode. This prevents the browser ESC key