Bug 1596391 - Remove nsIContent::IsActiveChildrenElement. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 14 Nov 2019 12:55:25 +0000
changeset 501931 f6794e4da7e8dc8c958338de8404716d559d4cba
parent 501930 853ed67836c6e75b432f804a3e628f3040968ff6
child 501932 8029fe5cc2a1bdd54e03e07a9a8498a9a1f3e655
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1596391
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596391 - Remove nsIContent::IsActiveChildrenElement. r=smaug Always returns false. Depends on D52991 Differential Revision: https://phabricator.services.mozilla.com/D52992
dom/base/ChildIterator.cpp
dom/base/nsIContent.h
dom/base/nsIContentInlines.h
layout/base/RestyleManager.cpp
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -44,17 +44,16 @@ nsIContent* ExplicitChildIterator::GetNe
       }
       return mChild;
     }
 
     MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
   } else if (mDefaultChild) {
     // If we're already in default content, check if there are more nodes there
     MOZ_ASSERT(mChild);
-    MOZ_ASSERT(mChild->IsActiveChildrenElement());
 
     mDefaultChild = mDefaultChild->GetNextSibling();
     if (mDefaultChild) {
       return mDefaultChild;
     }
 
     mChild = mChild->GetNextSibling();
   } else if (mIsFirst) {  // at the beginning of the child list
@@ -72,28 +71,16 @@ nsIContent* ExplicitChildIterator::GetNe
     }
 
     mChild = mParent->GetFirstChild();
     mIsFirst = false;
   } else if (mChild) {  // in the middle of the child list
     mChild = mChild->GetNextSibling();
   }
 
-  // Iterate until we find a non-insertion point, or an insertion point with
-  // content.
-  while (mChild) {
-    if (mChild->IsActiveChildrenElement()) {
-      MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
-    } else {
-      // mChild is not an insertion point, thus it is the next node to
-      // return from this iterator.
-      break;
-    }
-  }
-
   return mChild;
 }
 
 void FlattenedChildIterator::Init(bool aIgnoreXBL) {
   if (aIgnoreXBL) {
     return;
   }
 
@@ -116,17 +103,16 @@ bool ExplicitChildIterator::Seek(const n
   if (aChildToFind->GetParent() == mParent &&
       !aChildToFind->IsRootOfAnonymousSubtree()) {
     // Fast path: just point ourselves to aChildToFind, which is a
     // normal DOM child of ours.
     mChild = const_cast<nsIContent*>(aChildToFind);
     mIndexInInserted = 0;
     mDefaultChild = nullptr;
     mIsFirst = false;
-    MOZ_ASSERT(!mChild->IsActiveChildrenElement());
     return true;
   }
 
   // Can we add more fast paths here based on whether the parent of aChildToFind
   // is a shadow insertion point or content insertion point?
 
   // Slow path: just walk all our kids.
   return Seek(aChildToFind, nullptr);
@@ -189,28 +175,16 @@ nsIContent* ExplicitChildIterator::GetPr
         mChild = assignedNodes[mIndexInInserted - 1]->AsContent();
         return mChild;
       }
     }
 
     mChild = mParent->GetLastChild();
   }
 
-  // Iterate until we find a non-insertion point, or an insertion point with
-  // content.
-  while (mChild) {
-    if (mChild->IsActiveChildrenElement()) {
-      MOZ_ASSERT_UNREACHABLE("This needs to be revisited");
-    } else {
-      // mChild is not an insertion point, thus it is the next node to
-      // return from this iterator.
-      break;
-    }
-  }
-
   if (!mChild) {
     mIsFirst = true;
   }
 
   return mChild;
 }
 
 nsIContent* AllChildrenIterator::Get() const {
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -266,18 +266,16 @@ class nsIContent : public nsINode {
     return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
   }
 
   template <typename First, typename... Args>
   inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const {
     return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
   }
 
-  inline bool IsActiveChildrenElement() const;
-
   bool IsGeneratedContentContainerForBefore() const {
     return IsRootOfNativeAnonymousSubtree() &&
            mNodeInfo->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore;
   }
 
   bool IsGeneratedContentContainerForAfter() const {
     return IsRootOfNativeAnonymousSubtree() &&
            mNodeInfo->NameAtom() == nsGkAtoms::mozgeneratedcontentafter;
--- a/dom/base/nsIContentInlines.h
+++ b/dom/base/nsIContentInlines.h
@@ -112,19 +112,16 @@ static inline nsINode* GetFlattenedTreeP
     }
 
     if (auto* shadowRoot =
             mozilla::dom::ShadowRoot::FromNode(parentAsContent)) {
       return shadowRoot->GetHost();
     }
   }
 
-  MOZ_ASSERT(!parentAsContent->IsActiveChildrenElement(),
-             "<xbl:children> isn't in the flattened tree");
-
   // Common case.
   return parent;
 }
 
 inline nsINode* nsINode::GetFlattenedTreeParentNode() const {
   return ::GetFlattenedTreeParentNode<nsINode::eNotForStyle>(this);
 }
 
@@ -162,31 +159,16 @@ inline bool nsINode::IsEditable() const 
     return false;
   }
 
   // Check if the node is in a document and the document is in designMode.
   Document* doc = GetUncomposedDoc();
   return doc && doc->HasFlag(NODE_IS_EDITABLE);
 }
 
-inline bool nsIContent::IsActiveChildrenElement() const {
-  if (!mNodeInfo->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
-    return false;
-  }
-
-  nsIContent* bindingParent = GetBindingParent();
-  if (!bindingParent) {
-    return false;
-  }
-
-  // We reuse the binding parent machinery for Shadow DOM too, so prevent that
-  // from getting us confused in this case.
-  return !bindingParent->GetShadowRoot();
-}
-
 inline bool nsIContent::IsInAnonymousSubtree() const {
   NS_ASSERTION(
       !IsInNativeAnonymousSubtree() || GetBindingParent() ||
           (!IsInUncomposedDoc() && static_cast<nsIContent*>(SubtreeRoot())
                                        ->IsInNativeAnonymousSubtree()),
       "Must have binding parent when in native anonymous subtree which is in "
       "document.\n"
       "Native anonymous subtree which is not in document must have native "
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -3146,17 +3146,16 @@ void RestyleManager::DoProcessPendingRes
 
 #ifdef DEBUG
 static void VerifyFlatTree(const nsIContent& aContent) {
   StyleChildrenIterator iter(&aContent);
 
   for (auto* content = iter.GetNextChild(); content;
        content = iter.GetNextChild()) {
     MOZ_ASSERT(content->GetFlattenedTreeParentNodeForStyle() == &aContent);
-    MOZ_ASSERT(!content->IsActiveChildrenElement());
     VerifyFlatTree(*content);
   }
 }
 #endif
 
 void RestyleManager::ProcessPendingRestyles() {
 #ifdef DEBUG
   if (auto* root = mPresContext->Document()->GetRootElement()) {