From 5c02026b84b1de2ce3a6484299d150777fe82c87 Mon Sep 17 00:00:00 2001 From: btian Date: Fri, 11 Aug 2017 10:12:17 +0800 Subject: [PATCH] Bug 1384661 - Part 1: Rename class nsChildContentList to nsAttrChildContentList. r=smaug --HG-- extra : rebase_source : a4fe54aa9cf3423fe952391654ae40e3aca3a66f --- dom/base/FragmentOrElement.cpp | 33 +++++++++++++++++---------------- dom/base/nsChildContentList.h | 11 ++++++----- dom/base/nsINode.cpp | 2 +- dom/base/nsINode.h | 4 ++-- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 50724bed5528..4f232267ced2 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -494,42 +494,43 @@ NeedsScriptTraverse(nsINode* aNode) //---------------------------------------------------------------------- -NS_IMPL_CYCLE_COLLECTING_ADDREF(nsChildContentList) -NS_IMPL_CYCLE_COLLECTING_RELEASE(nsChildContentList) +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAttrChildContentList) +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAttrChildContentList) -// If nsChildContentList is changed so that any additional fields are +// If nsAttrChildContentList is changed so that any additional fields are // traversed by the cycle collector, then CAN_SKIP must be updated to // check that the additional fields are null. -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsChildContentList) +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsAttrChildContentList) -// nsChildContentList only ever has a single child, its wrapper, so if +// nsAttrChildContentList only ever has a single child, its wrapper, so if // the wrapper is known-live, the list can't be part of a garbage cycle. -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsChildContentList) +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsAttrChildContentList) return tmp->HasKnownLiveWrapper(); NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsChildContentList) +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsAttrChildContentList) return tmp->HasKnownLiveWrapperAndDoesNotNeedTracing(tmp); NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END // CanSkipThis returns false to avoid problems with incomplete unlinking. -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsChildContentList) +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsAttrChildContentList) NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END -NS_INTERFACE_TABLE_HEAD(nsChildContentList) +NS_INTERFACE_TABLE_HEAD(nsAttrChildContentList) NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY - NS_INTERFACE_TABLE(nsChildContentList, nsINodeList, nsIDOMNodeList) - NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsChildContentList) + NS_INTERFACE_TABLE(nsAttrChildContentList, nsINodeList, nsIDOMNodeList) + NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsAttrChildContentList) NS_INTERFACE_MAP_END JSObject* -nsChildContentList::WrapObject(JSContext *cx, JS::Handle aGivenProto) +nsAttrChildContentList::WrapObject(JSContext *cx, + JS::Handle aGivenProto) { return NodeListBinding::Wrap(cx, this, aGivenProto); } NS_IMETHODIMP -nsChildContentList::GetLength(uint32_t* aLength) +nsAttrChildContentList::GetLength(uint32_t* aLength) { *aLength = mNode ? mNode->GetChildCount() : 0; @@ -537,7 +538,7 @@ nsChildContentList::GetLength(uint32_t* aLength) } NS_IMETHODIMP -nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn) +nsAttrChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn) { nsINode* node = Item(aIndex); if (!node) { @@ -550,7 +551,7 @@ nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn) } nsIContent* -nsChildContentList::Item(uint32_t aIndex) +nsAttrChildContentList::Item(uint32_t aIndex) { if (mNode) { return mNode->GetChildAt(aIndex); @@ -560,7 +561,7 @@ nsChildContentList::Item(uint32_t aIndex) } int32_t -nsChildContentList::IndexOf(nsIContent* aContent) +nsAttrChildContentList::IndexOf(nsIContent* aContent) { if (mNode) { return mNode->IndexOf(aContent); diff --git a/dom/base/nsChildContentList.h b/dom/base/nsChildContentList.h index 96c4e0eff134..104ddccdbc5a 100644 --- a/dom/base/nsChildContentList.h +++ b/dom/base/nsChildContentList.h @@ -20,19 +20,20 @@ class nsINode; * and Item to its existing child list. * @see nsIDOMNodeList */ -class nsChildContentList final : public nsINodeList +class nsAttrChildContentList final : public nsINodeList { public: - explicit nsChildContentList(nsINode* aNode) + explicit nsAttrChildContentList(nsINode* aNode) : mNode(aNode) { } NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList) + NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsAttrChildContentList) // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, JS::Handle aGivenProto) override; + virtual JSObject* WrapObject(JSContext *cx, + JS::Handle aGivenProto) override; // nsIDOMNodeList interface NS_DECL_NSIDOMNODELIST @@ -52,7 +53,7 @@ public: } private: - ~nsChildContentList() {} + ~nsAttrChildContentList() {} // The node whose children make up the list. // This is a non-owning ref which is safe because it's set to nullptr by diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index 4075a88d9f0c..aa9b32063c15 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -409,7 +409,7 @@ nsINode::ChildNodes() { nsSlots* slots = Slots(); if (!slots->mChildNodes) { - slots->mChildNodes = new nsChildContentList(this); + slots->mChildNodes = new nsAttrChildContentList(this); } return slots->mChildNodes; diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 72748a872c11..5cd5a6a0819b 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -36,7 +36,7 @@ #endif class nsAttrAndChildArray; -class nsChildContentList; +class nsAttrChildContentList; struct nsCSSSelectorList; class nsDOMAttributeMap; class nsIAnimationObserver; @@ -1112,7 +1112,7 @@ public: * @see nsIDOMNodeList * @see nsGenericHTMLElement::GetChildNodes */ - RefPtr mChildNodes; + RefPtr mChildNodes; /** * Weak reference to this node. This is cleared by the destructor of