From 05a1fd9f6a7ca2f46b5961e7e9451da2f2664301 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 --- 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 98d8939392a6..b8a313a105f0 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -521,42 +521,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; @@ -564,7 +565,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) { @@ -577,7 +578,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); @@ -587,7 +588,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 e9e4a014d17a..68a706531b69 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 11502f59158e..ff53eea71616 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -35,7 +35,7 @@ #endif class nsAttrAndChildArray; -class nsChildContentList; +class nsAttrChildContentList; struct nsCSSSelectorList; class nsDOMAttributeMap; class nsIAnimationObserver; @@ -1116,7 +1116,7 @@ public: * @see nsIDOMNodeList * @see nsGenericHTMLElement::GetChildNodes */ - RefPtr mChildNodes; + RefPtr mChildNodes; /** * Weak reference to this node. This is cleared by the destructor of