diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 0d6a59f95f5a..debe455458f1 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -1396,12 +1396,13 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame, if (table) { nsIContent* parentContent = - aContent->GetParentOrHostNode()->AsContent(); + aContent->GetParentOrShadowHostNode()->AsContent(); nsIFrame* parentFrame = nullptr; if (parentContent) { parentFrame = parentContent->GetPrimaryFrame(); if (!parentFrame || !parentFrame->IsTableWrapperFrame()) { - parentContent = parentContent->GetParentOrHostNode()->AsContent(); + parentContent = + parentContent->GetParentOrShadowHostNode()->AsContent(); if (parentContent) { parentFrame = parentContent->GetPrimaryFrame(); } diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 7ce14bfcdebc..b136d30e65ee 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -759,7 +759,7 @@ static nsINode* FindChromeAccessOnlySubtreeOwner(nsINode* aNode) { aNode = aNode->GetParentNode(); } - return aNode ? aNode->GetParentOrHostNode() : nullptr; + return aNode ? aNode->GetParentOrShadowHostNode() : nullptr; } already_AddRefed FindChromeAccessOnlySubtreeOwner( diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index 945af4713449..d3165c847968 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -261,7 +261,7 @@ nsINode* nsINode::GetRootNode(const GetRootNodeOptions& aOptions) { return SubtreeRoot(); } -nsINode* nsINode::GetParentOrHostNode() const { +nsINode* nsINode::GetParentOrShadowHostNode() const { if (mParent) { return mParent; } diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 539f89881d8b..609cc3bea76c 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -884,11 +884,7 @@ class nsINode : public mozilla::dom::EventTarget { */ nsINode* GetParentNode() const { return mParent; } - /** - * This is similar to above, but in case 'this' is ShadowRoot, we return its - * host element. - */ - nsINode* GetParentOrHostNode() const; + nsINode* GetParentOrShadowHostNode() const; enum FlattenedParentType { eNotForStyle, eForStyle }; diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp index 46ffde2ecd57..0f44d9286fad 100644 --- a/dom/svg/SVGUseElement.cpp +++ b/dom/svg/SVGUseElement.cpp @@ -244,8 +244,8 @@ bool SVGUseElement::IsCyclicReferenceTo(const Element& aTarget) const { if (mOriginal && mOriginal->IsCyclicReferenceTo(aTarget)) { return true; } - for (nsINode* parent = GetParentOrHostNode(); parent; - parent = parent->GetParentOrHostNode()) { + for (nsINode* parent = GetParentOrShadowHostNode(); parent; + parent = parent->GetParentOrShadowHostNode()) { if (parent == &aTarget) { return true; } diff --git a/editor/libeditor/HTMLEditRules.cpp b/editor/libeditor/HTMLEditRules.cpp index 6cf04e512f8e..aab1f18e052e 100644 --- a/editor/libeditor/HTMLEditRules.cpp +++ b/editor/libeditor/HTMLEditRules.cpp @@ -10048,7 +10048,7 @@ nsresult HTMLEditRules::ConfirmSelectionInBody() { // XXXsmaug this code is insane. nsINode* temp = selectionStartPoint.GetContainer(); while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) { - temp = temp->GetParentOrHostNode(); + temp = temp->GetParentOrShadowHostNode(); } // If we aren't in the element, force the issue. @@ -10074,7 +10074,7 @@ nsresult HTMLEditRules::ConfirmSelectionInBody() { // XXXsmaug this code is insane. temp = selectionEndPoint.GetContainer(); while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) { - temp = temp->GetParentOrHostNode(); + temp = temp->GetParentOrShadowHostNode(); } // If we aren't in the element, force the issue. diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 166cf23893b1..046e409159de 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -4725,7 +4725,7 @@ UniquePtr PresShell::CreateRangePaintInfo( break; } - ancestor = ancestor->GetParentOrHostNode(); + ancestor = ancestor->GetParentOrShadowHostNode(); } // use the nearest ancestor frame that includes all continuations as the diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index a9d82a00947f..071732588f34 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1669,7 +1669,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition( AutoTArray content1Ancestors; nsINode* c1; for (c1 = aContent1; c1 && c1 != aCommonAncestor; - c1 = c1->GetParentOrHostNode()) { + c1 = c1->GetParentOrShadowHostNode()) { content1Ancestors.AppendElement(c1); } if (!c1 && aCommonAncestor) { @@ -1681,7 +1681,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition( AutoTArray content2Ancestors; nsINode* c2; for (c2 = aContent2; c2 && c2 != aCommonAncestor; - c2 = c2->GetParentOrHostNode()) { + c2 = c2->GetParentOrShadowHostNode()) { content2Ancestors.AppendElement(c2); } if (!c2 && aCommonAncestor) { @@ -1718,7 +1718,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition( // content1Ancestor != content2Ancestor, so they must be siblings with the // same parent - nsINode* parent = content1Ancestor->GetParentOrHostNode(); + nsINode* parent = content1Ancestor->GetParentOrShadowHostNode(); #ifdef DEBUG // TODO: remove the uglyness, see bug 598468. NS_ASSERTION(gPreventAssertInCompareTreePosition || parent,