Bug 1709200 - Rename nsContentUtils::GetRootDocument to GetInProcessSubtreeRootDocument; r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D114177
This commit is contained in:
Edgar Chen 2021-05-05 09:42:20 +00:00
Родитель bb5a3fe5a8
Коммит a3ff3d48aa
7 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -449,7 +449,8 @@ struct OopIframeMetrics {
static Maybe<OopIframeMetrics> 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<OopIframeMetrics> 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.
//

Просмотреть файл

@ -13696,7 +13696,8 @@ bool FullscreenRoots::Contains(Document* aRoot) {
/* static */
void FullscreenRoots::Add(Document* aDoc) {
nsCOMPtr<Document> root = nsContentUtils::GetRootDocument(aDoc);
nsCOMPtr<Document> 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<Document> root = nsContentUtils::GetRootDocument(aDoc);
nsCOMPtr<Document> 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<FullscreenRequest> 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

Просмотреть файл

@ -6944,7 +6944,7 @@ void nsContentUtils::FireMutationEventsForDirectParsing(
}
/* static */
Document* nsContentUtils::GetRootDocument(Document* aDoc) {
Document* nsContentUtils::GetInProcessSubtreeRootDocument(Document* aDoc) {
if (!aDoc) {
return nullptr;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -327,7 +327,7 @@ void GetBoxQuadsFromWindowOrigin(nsINode* aNode,
BoxQuadOptions bqo(aOptions);
RefPtr<Document> topInProcessDoc =
nsContentUtils::GetRootDocument(aNode->OwnerDoc());
nsContentUtils::GetInProcessSubtreeRootDocument(aNode->OwnerDoc());
OwningGeometryNode ogn;
ogn.SetAsDocument() = topInProcessDoc;

Просмотреть файл

@ -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