Bug 1384661 - Part 1: Rename class nsChildContentList to nsAttrChildContentList. r=smaug

--HG--
extra : rebase_source : a4fe54aa9cf3423fe952391654ae40e3aca3a66f
This commit is contained in:
btian 2017-08-11 10:12:17 +08:00
Родитель 0f32c9b07b
Коммит 5c02026b84
4 изменённых файлов: 26 добавлений и 24 удалений

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

@ -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<JSObject*> aGivenProto)
nsAttrChildContentList::WrapObject(JSContext *cx,
JS::Handle<JSObject*> 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);

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

@ -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<JSObject*> aGivenProto) override;
virtual JSObject* WrapObject(JSContext *cx,
JS::Handle<JSObject*> 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

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

@ -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;

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

@ -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<nsChildContentList> mChildNodes;
RefPtr<nsAttrChildContentList> mChildNodes;
/**
* Weak reference to this node. This is cleared by the destructor of