Commit 89958b37 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1640605 - Remove IsInAnonymousSubtree / IsRootOfAnonymousSubtree. r=edgar

In favor of the NativeAnonymous versions which they forward to.

Done automatically with:

  rg -l 'IsInAnonymousSubtree' | xargs sed -i 's/IsInAnonymousSubtree/IsInNativeAnonymousSubtree/g'

And removing the function definitions afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D76681
parent de03967d
......@@ -246,7 +246,7 @@ dom::Element* IDRefsIterator::GetElem(nsIContent* aContent,
const nsAString& aID) {
// Get elements in DOM tree by ID attribute if this is an explicit content.
// In case of bound element check its anonymous subtree.
if (!aContent->IsInAnonymousSubtree()) {
if (!aContent->IsInNativeAnonymousSubtree()) {
dom::DocumentOrShadowRoot* docOrShadowRoot =
aContent->GetUncomposedDocOrConnectedShadowRoot();
if (docOrShadowRoot) {
......
......@@ -66,7 +66,7 @@ MARKUPMAP(
[](Element* aElement, Accessible* aContext) -> Accessible* {
// Never create an accessible if we're part of an anonymous
// subtree.
if (aElement->IsInAnonymousSubtree()) {
if (aElement->IsInNativeAnonymousSubtree()) {
return nullptr;
}
// Always create an accessible if the div has an id.
......
......@@ -101,7 +101,7 @@ void FlattenedChildIterator::Init(bool aIgnoreXBL) {
bool ExplicitChildIterator::Seek(const nsIContent* aChildToFind) {
if (aChildToFind->GetParent() == mParent &&
!aChildToFind->IsRootOfAnonymousSubtree()) {
!aChildToFind->IsRootOfNativeAnonymousSubtree()) {
// Fast path: just point ourselves to aChildToFind, which is a
// normal DOM child of ours.
mChild = const_cast<nsIContent*>(aChildToFind);
......
......@@ -285,7 +285,7 @@ static bool DoesNotParticipateInAutoDirection(const nsIContent* aContent) {
nodeInfo->Equals(nsGkAtoms::style) ||
nodeInfo->Equals(nsGkAtoms::input) ||
nodeInfo->Equals(nsGkAtoms::textarea) ||
aContent->IsInAnonymousSubtree())) &&
aContent->IsInNativeAnonymousSubtree())) &&
!aContent->IsShadowRoot();
}
......@@ -320,7 +320,7 @@ inline static bool NodeAffectsDirAutoAncestor(nsIContent* aTextNode) {
nsIContent* parent = GetParentOrHostOrSlot(aTextNode);
return (parent && !DoesNotParticipateInAutoDirection(parent) &&
parent->NodeOrAncestorHasDirAuto() &&
!aTextNode->IsInAnonymousSubtree());
!aTextNode->IsInNativeAnonymousSubtree());
}
Directionality GetDirectionFromText(const char16_t* aText,
......
......@@ -9273,7 +9273,7 @@ nsINode* Document::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv) {
case COMMENT_NODE:
case DOCUMENT_TYPE_NODE: {
// Don't allow adopting a node's anonymous subtree out from under it.
if (adoptedNode->AsContent()->IsRootOfAnonymousSubtree()) {
if (adoptedNode->AsContent()->IsRootOfNativeAnonymousSubtree()) {
rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
......@@ -10706,7 +10706,7 @@ nsIContent* Document::GetContentInThisDocument(nsIFrame* aFrame) const {
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f)) {
nsIContent* content = f->GetContent();
if (!content || content->IsInAnonymousSubtree()) continue;
if (!content || content->IsInNativeAnonymousSubtree()) continue;
 
if (content->OwnerDoc() == this) {
return content;
......
......@@ -922,7 +922,7 @@ void Element::AddToIdTable(nsAtom* aId) {
containingShadow->AddToIdTable(this, aId);
} else {
Document* doc = GetUncomposedDoc();
if (doc && !IsInAnonymousSubtree()) {
if (doc && !IsInNativeAnonymousSubtree()) {
doc->AddToIdTable(this, aId);
}
}
......@@ -943,7 +943,7 @@ void Element::RemoveFromIdTable() {
}
} else {
Document* doc = GetUncomposedDoc();
if (doc && !IsInAnonymousSubtree()) {
if (doc && !IsInNativeAnonymousSubtree()) {
doc->RemoveFromIdTable(this, id);
}
}
......@@ -1707,7 +1707,7 @@ void Element::UnbindFromTree(bool aNullParent) {
if (HasServoData()) {
MOZ_ASSERT(document);
MOZ_ASSERT(IsInAnonymousSubtree());
MOZ_ASSERT(IsInNativeAnonymousSubtree());
}
if (document) {
......
......@@ -663,7 +663,7 @@ void ShadowRoot::MaybeUnslotHostChild(nsIContent& aChild) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(!aChild.IsRootOfAnonymousSubtree(),
MOZ_DIAGNOSTIC_ASSERT(!aChild.IsRootOfNativeAnonymousSubtree(),
"How did aChild end up assigned to a slot?");
// If the slot is going to start showing fallback content, we need to tell
// layout about it.
......@@ -679,7 +679,7 @@ void ShadowRoot::MaybeSlotHostChild(nsIContent& aChild) {
MOZ_ASSERT(aChild.GetParent() == GetHost());
// Check to ensure that the child not an anonymous subtree root because even
// though its parent could be the host it may not be in the host's child list.
if (aChild.IsRootOfAnonymousSubtree()) {
if (aChild.IsRootOfNativeAnonymousSubtree()) {
return;
}
......
......@@ -2700,7 +2700,7 @@ void nsContentUtils::GenerateStateKey(nsIContent* aContent, Document* aDocument,
uint32_t partID = aDocument ? aDocument->GetPartID() : 0;
// Don't capture state for anonymous content
if (aContent->IsInAnonymousSubtree()) {
if (aContent->IsInNativeAnonymousSubtree()) {
return;
}
......
......@@ -68,7 +68,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMMutationRecord, mTarget,
bool nsMutationReceiverBase::IsObservable(nsIContent* aContent) {
return !aContent->ChromeOnlyAccess() &&
(Observer()->IsChrome() || !aContent->IsInAnonymousSubtree());
(Observer()->IsChrome() || !aContent->IsInNativeAnonymousSubtree());
}
NS_IMPL_ADDREF(nsMutationReceiver)
......
......@@ -187,16 +187,6 @@ class nsIContent : public nsINode {
*/
nsIContent* FindFirstNonChromeOnlyAccessContent() const;
/**
* Returns true if and only if this node has a parent, but is not in
* its parent's child list.
*
* FIXME(emilio): Remove along nsINode::IsInAnonymousSubtree.
*/
bool IsRootOfAnonymousSubtree() const {
return IsRootOfNativeAnonymousSubtree();
}
/**
* Return true iff this node is in an HTML document (in the HTML5 sense of
* the term, i.e. not in an XHTML/XML document).
......
......@@ -94,7 +94,7 @@ static inline nsINode* GetFlattenedTreeParentNode(const nsINode* aNode) {
return docLevel ? content->OwnerDocAsNode() : parent;
}
if (content->IsRootOfAnonymousSubtree()) {
if (content->IsRootOfNativeAnonymousSubtree()) {
return parent;
}
......@@ -171,7 +171,7 @@ inline void nsIContent::HandleInsertionToOrRemovalFromSlot() {
using mozilla::dom::HTMLSlotElement;
MOZ_ASSERT(GetParentElement());
if (!IsInShadowTree() || IsRootOfAnonymousSubtree()) {
if (!IsInShadowTree() || IsRootOfNativeAnonymousSubtree()) {
return;
}
HTMLSlotElement* slot = HTMLSlotElement::FromNode(mParent);
......
......@@ -774,7 +774,7 @@ nsINode* nsINode::RemoveChild(nsINode& aOldChild, ErrorResult& aError) {
// Check again, we may not be the child's parent anymore.
// Can be triggered by dom/base/crashtests/293388-1.html
if (aOldChild.AsContent()->IsRootOfAnonymousSubtree() ||
if (aOldChild.AsContent()->IsRootOfNativeAnonymousSubtree() ||
aOldChild.GetParentNode() != this) {
// aOldChild isn't one of our children.
aError.ThrowNotFoundError(
......@@ -2302,7 +2302,7 @@ void nsINode::EnsurePreInsertionValidity2(bool aReplace, nsINode& aNewChild,
nsINode* aRefChild,
ErrorResult& aError) {
if (aNewChild.IsContent() &&
aNewChild.AsContent()->IsRootOfAnonymousSubtree()) {
aNewChild.AsContent()->IsRootOfNativeAnonymousSubtree()) {
// This is anonymous content. Don't allow its insertion
// anywhere, since it might have UnbindFromTree calls coming
// its way.
......@@ -2748,7 +2748,7 @@ bool nsINode::Contains(const nsINode* aOther) const {
// document.contains(aOther) returns true if aOther is in the document,
// but is not in any anonymous subtree.
// IsInUncomposedDoc() check is done already before this.
return !aOther->IsInAnonymousSubtree();
return !aOther->IsInNativeAnonymousSubtree();
}
if (!IsElement() && !IsDocumentFragment()) {
......
......@@ -1295,16 +1295,6 @@ class nsINode : public mozilla::dom::EventTarget {
return HasFlag(NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE);
}
/**
* Returns true if there is NOT a path through child lists
* from the top of this node's parent chain back to this node or
* if the node is in native anonymous subtree without a parent.
*
* TODO(emilio):: Remove this function, and use just
* IsInNativeAnonymousSubtree, or something?
*/
bool IsInAnonymousSubtree() const { return IsInNativeAnonymousSubtree(); }
/**
* If |this| or any ancestor is native anonymous, return the root of the
* native anonymous subtree. Note that in case of nested native anonymous
......
......@@ -102,7 +102,7 @@ void Event::InitPresContextData(nsPresContext* aPresContext) {
{
nsCOMPtr<nsIContent> content = GetTargetFromFrame();
mExplicitOriginalTarget = content;
if (content && content->IsInAnonymousSubtree()) {
if (content && content->IsInNativeAnonymousSubtree()) {
mExplicitOriginalTarget = nullptr;
}
}
......
......@@ -892,7 +892,7 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
bool clearTargets = false;
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->mOriginalTarget);
bool isInAnon = content && content->IsInAnonymousSubtree();
bool isInAnon = content && content->IsInNativeAnonymousSubtree();
aEvent->mFlags.mIsBeingDispatched = true;
......
......@@ -2862,7 +2862,7 @@ nsIRadioGroupContainer* HTMLInputElement::GetRadioGroupContainer() const {
return mForm;
}
if (IsInAnonymousSubtree()) {
if (IsInNativeAnonymousSubtree()) {
return nullptr;
}
......@@ -6059,8 +6059,8 @@ bool HTMLInputElement::AllowDrop() {
void HTMLInputElement::AddedToRadioGroup() {
// If the element is neither in a form nor a document, there is no group so we
// should just stop here.
if (!mForm &&
(!GetUncomposedDocOrConnectedShadowRoot() || IsInAnonymousSubtree())) {
if (!mForm && (!GetUncomposedDocOrConnectedShadowRoot() ||
IsInNativeAnonymousSubtree())) {
return;
}
......
......@@ -146,7 +146,7 @@ static const nsAttrValue::EnumTable kDirTable[] = {
void nsGenericHTMLElement::AddToNameTable(nsAtom* aName) {
MOZ_ASSERT(HasName(), "Node doesn't have name?");
Document* doc = GetUncomposedDoc();
if (doc && !IsInAnonymousSubtree()) {
if (doc && !IsInNativeAnonymousSubtree()) {
doc->AddToNameTable(this, aName);
}
}
......
......@@ -248,7 +248,7 @@ void HTMLEditor::DeleteRefToAnonymousNode(ManualNACPtr aContent,
// See bug 338129.
if (aContent->IsInComposedDoc() && aPresShell &&
!aPresShell->IsDestroying()) {
MOZ_ASSERT(aContent->IsRootOfAnonymousSubtree());
MOZ_ASSERT(aContent->IsRootOfNativeAnonymousSubtree());
MOZ_ASSERT(!aContent->GetPreviousSibling(), "NAC has no siblings");
// FIXME(emilio): This is the only caller to PresShell::ContentRemoved that
......
......@@ -1082,7 +1082,7 @@ bool mozInlineSpellChecker::ShouldSpellCheckNode(TextEditor* aTextEditor,
// Make sure that we can always turn on spell checking for inputs/textareas.
// Note that because of the previous check, at this point we know that the
// node is editable.
if (content->IsInAnonymousSubtree()) {
if (content->IsInNativeAnonymousSubtree()) {
nsIContent* node = content->GetParent();
while (node && node->IsInNativeAnonymousSubtree()) {
node = node->GetParent();
......
......@@ -43,7 +43,7 @@ static already_AddRefed<dom::Element> ElementFromPoint(
RelativeTo{rootFrame, ViewportType::Visual}, CSSPoint::ToAppUnits(aPoint),
{FrameForPointOption::IgnorePaintSuppression});
while (frame && (!frame->GetContent() ||
frame->GetContent()->IsInAnonymousSubtree())) {
frame->GetContent()->IsInNativeAnonymousSubtree())) {
frame = nsLayoutUtils::GetParentOrPlaceholderFor(frame);
}
if (!frame) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment