Bug 1566046: rename `GetParentOrHostNode` to `GetParentOrShadowHostNode`. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D38078
This commit is contained in:
Mirko Brodesser 2019-07-15 13:03:33 +02:00
Родитель 22b330ecb3
Коммит 1669cc6770
8 изменённых файлов: 14 добавлений и 17 удалений

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

@ -1396,12 +1396,13 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
if (table) { if (table) {
nsIContent* parentContent = nsIContent* parentContent =
aContent->GetParentOrHostNode()->AsContent(); aContent->GetParentOrShadowHostNode()->AsContent();
nsIFrame* parentFrame = nullptr; nsIFrame* parentFrame = nullptr;
if (parentContent) { if (parentContent) {
parentFrame = parentContent->GetPrimaryFrame(); parentFrame = parentContent->GetPrimaryFrame();
if (!parentFrame || !parentFrame->IsTableWrapperFrame()) { if (!parentFrame || !parentFrame->IsTableWrapperFrame()) {
parentContent = parentContent->GetParentOrHostNode()->AsContent(); parentContent =
parentContent->GetParentOrShadowHostNode()->AsContent();
if (parentContent) { if (parentContent) {
parentFrame = parentContent->GetPrimaryFrame(); parentFrame = parentContent->GetPrimaryFrame();
} }

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

@ -759,7 +759,7 @@ static nsINode* FindChromeAccessOnlySubtreeOwner(nsINode* aNode) {
aNode = aNode->GetParentNode(); aNode = aNode->GetParentNode();
} }
return aNode ? aNode->GetParentOrHostNode() : nullptr; return aNode ? aNode->GetParentOrShadowHostNode() : nullptr;
} }
already_AddRefed<nsINode> FindChromeAccessOnlySubtreeOwner( already_AddRefed<nsINode> FindChromeAccessOnlySubtreeOwner(

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

@ -261,7 +261,7 @@ nsINode* nsINode::GetRootNode(const GetRootNodeOptions& aOptions) {
return SubtreeRoot(); return SubtreeRoot();
} }
nsINode* nsINode::GetParentOrHostNode() const { nsINode* nsINode::GetParentOrShadowHostNode() const {
if (mParent) { if (mParent) {
return mParent; return mParent;
} }

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

@ -884,11 +884,7 @@ class nsINode : public mozilla::dom::EventTarget {
*/ */
nsINode* GetParentNode() const { return mParent; } nsINode* GetParentNode() const { return mParent; }
/** nsINode* GetParentOrShadowHostNode() const;
* This is similar to above, but in case 'this' is ShadowRoot, we return its
* host element.
*/
nsINode* GetParentOrHostNode() const;
enum FlattenedParentType { eNotForStyle, eForStyle }; enum FlattenedParentType { eNotForStyle, eForStyle };

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

@ -244,8 +244,8 @@ bool SVGUseElement::IsCyclicReferenceTo(const Element& aTarget) const {
if (mOriginal && mOriginal->IsCyclicReferenceTo(aTarget)) { if (mOriginal && mOriginal->IsCyclicReferenceTo(aTarget)) {
return true; return true;
} }
for (nsINode* parent = GetParentOrHostNode(); parent; for (nsINode* parent = GetParentOrShadowHostNode(); parent;
parent = parent->GetParentOrHostNode()) { parent = parent->GetParentOrShadowHostNode()) {
if (parent == &aTarget) { if (parent == &aTarget) {
return true; return true;
} }

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

@ -10048,7 +10048,7 @@ nsresult HTMLEditRules::ConfirmSelectionInBody() {
// XXXsmaug this code is insane. // XXXsmaug this code is insane.
nsINode* temp = selectionStartPoint.GetContainer(); nsINode* temp = selectionStartPoint.GetContainer();
while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) { while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) {
temp = temp->GetParentOrHostNode(); temp = temp->GetParentOrShadowHostNode();
} }
// If we aren't in the <body> element, force the issue. // If we aren't in the <body> element, force the issue.
@ -10074,7 +10074,7 @@ nsresult HTMLEditRules::ConfirmSelectionInBody() {
// XXXsmaug this code is insane. // XXXsmaug this code is insane.
temp = selectionEndPoint.GetContainer(); temp = selectionEndPoint.GetContainer();
while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) { while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) {
temp = temp->GetParentOrHostNode(); temp = temp->GetParentOrShadowHostNode();
} }
// If we aren't in the <body> element, force the issue. // If we aren't in the <body> element, force the issue.

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

@ -4725,7 +4725,7 @@ UniquePtr<RangePaintInfo> PresShell::CreateRangePaintInfo(
break; break;
} }
ancestor = ancestor->GetParentOrHostNode(); ancestor = ancestor->GetParentOrShadowHostNode();
} }
// use the nearest ancestor frame that includes all continuations as the // use the nearest ancestor frame that includes all continuations as the

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

@ -1669,7 +1669,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition(
AutoTArray<nsINode*, 32> content1Ancestors; AutoTArray<nsINode*, 32> content1Ancestors;
nsINode* c1; nsINode* c1;
for (c1 = aContent1; c1 && c1 != aCommonAncestor; for (c1 = aContent1; c1 && c1 != aCommonAncestor;
c1 = c1->GetParentOrHostNode()) { c1 = c1->GetParentOrShadowHostNode()) {
content1Ancestors.AppendElement(c1); content1Ancestors.AppendElement(c1);
} }
if (!c1 && aCommonAncestor) { if (!c1 && aCommonAncestor) {
@ -1681,7 +1681,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition(
AutoTArray<nsINode*, 32> content2Ancestors; AutoTArray<nsINode*, 32> content2Ancestors;
nsINode* c2; nsINode* c2;
for (c2 = aContent2; c2 && c2 != aCommonAncestor; for (c2 = aContent2; c2 && c2 != aCommonAncestor;
c2 = c2->GetParentOrHostNode()) { c2 = c2->GetParentOrShadowHostNode()) {
content2Ancestors.AppendElement(c2); content2Ancestors.AppendElement(c2);
} }
if (!c2 && aCommonAncestor) { if (!c2 && aCommonAncestor) {
@ -1718,7 +1718,7 @@ int32_t nsLayoutUtils::DoCompareTreePosition(
// content1Ancestor != content2Ancestor, so they must be siblings with the // content1Ancestor != content2Ancestor, so they must be siblings with the
// same parent // same parent
nsINode* parent = content1Ancestor->GetParentOrHostNode(); nsINode* parent = content1Ancestor->GetParentOrShadowHostNode();
#ifdef DEBUG #ifdef DEBUG
// TODO: remove the uglyness, see bug 598468. // TODO: remove the uglyness, see bug 598468.
NS_ASSERTION(gPreventAssertInCompareTreePosition || parent, NS_ASSERTION(gPreventAssertInCompareTreePosition || parent,