зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384661 - Part 1: Rename class nsChildContentList to nsAttrChildContentList. r=smaug
--HG-- extra : rebase_source : a4fe54aa9cf3423fe952391654ae40e3aca3a66f
This commit is contained in:
Родитель
0f32c9b07b
Коммит
5c02026b84
|
@ -494,42 +494,43 @@ NeedsScriptTraverse(nsINode* aNode)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsChildContentList)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAttrChildContentList)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsChildContentList)
|
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
|
// traversed by the cycle collector, then CAN_SKIP must be updated to
|
||||||
// check that the additional fields are null.
|
// 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.
|
// 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();
|
return tmp->HasKnownLiveWrapper();
|
||||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
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);
|
return tmp->HasKnownLiveWrapperAndDoesNotNeedTracing(tmp);
|
||||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
||||||
|
|
||||||
// CanSkipThis returns false to avoid problems with incomplete unlinking.
|
// 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_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
||||||
|
|
||||||
NS_INTERFACE_TABLE_HEAD(nsChildContentList)
|
NS_INTERFACE_TABLE_HEAD(nsAttrChildContentList)
|
||||||
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
||||||
NS_INTERFACE_TABLE(nsChildContentList, nsINodeList, nsIDOMNodeList)
|
NS_INTERFACE_TABLE(nsAttrChildContentList, nsINodeList, nsIDOMNodeList)
|
||||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsChildContentList)
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsAttrChildContentList)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
nsChildContentList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
|
nsAttrChildContentList::WrapObject(JSContext *cx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
return NodeListBinding::Wrap(cx, this, aGivenProto);
|
return NodeListBinding::Wrap(cx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsChildContentList::GetLength(uint32_t* aLength)
|
nsAttrChildContentList::GetLength(uint32_t* aLength)
|
||||||
{
|
{
|
||||||
*aLength = mNode ? mNode->GetChildCount() : 0;
|
*aLength = mNode ? mNode->GetChildCount() : 0;
|
||||||
|
|
||||||
|
@ -537,7 +538,7 @@ nsChildContentList::GetLength(uint32_t* aLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
nsAttrChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
nsINode* node = Item(aIndex);
|
nsINode* node = Item(aIndex);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
@ -550,7 +551,7 @@ nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
nsChildContentList::Item(uint32_t aIndex)
|
nsAttrChildContentList::Item(uint32_t aIndex)
|
||||||
{
|
{
|
||||||
if (mNode) {
|
if (mNode) {
|
||||||
return mNode->GetChildAt(aIndex);
|
return mNode->GetChildAt(aIndex);
|
||||||
|
@ -560,7 +561,7 @@ nsChildContentList::Item(uint32_t aIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
nsChildContentList::IndexOf(nsIContent* aContent)
|
nsAttrChildContentList::IndexOf(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
if (mNode) {
|
if (mNode) {
|
||||||
return mNode->IndexOf(aContent);
|
return mNode->IndexOf(aContent);
|
||||||
|
|
|
@ -20,19 +20,20 @@ class nsINode;
|
||||||
* and Item to its existing child list.
|
* and Item to its existing child list.
|
||||||
* @see nsIDOMNodeList
|
* @see nsIDOMNodeList
|
||||||
*/
|
*/
|
||||||
class nsChildContentList final : public nsINodeList
|
class nsAttrChildContentList final : public nsINodeList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit nsChildContentList(nsINode* aNode)
|
explicit nsAttrChildContentList(nsINode* aNode)
|
||||||
: mNode(aNode)
|
: mNode(aNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList)
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsAttrChildContentList)
|
||||||
|
|
||||||
// nsWrapperCache
|
// nsWrapperCache
|
||||||
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext *cx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
// nsIDOMNodeList interface
|
// nsIDOMNodeList interface
|
||||||
NS_DECL_NSIDOMNODELIST
|
NS_DECL_NSIDOMNODELIST
|
||||||
|
@ -52,7 +53,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~nsChildContentList() {}
|
~nsAttrChildContentList() {}
|
||||||
|
|
||||||
// The node whose children make up the list.
|
// The node whose children make up the list.
|
||||||
// This is a non-owning ref which is safe because it's set to nullptr by
|
// 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();
|
nsSlots* slots = Slots();
|
||||||
if (!slots->mChildNodes) {
|
if (!slots->mChildNodes) {
|
||||||
slots->mChildNodes = new nsChildContentList(this);
|
slots->mChildNodes = new nsAttrChildContentList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return slots->mChildNodes;
|
return slots->mChildNodes;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class nsAttrAndChildArray;
|
class nsAttrAndChildArray;
|
||||||
class nsChildContentList;
|
class nsAttrChildContentList;
|
||||||
struct nsCSSSelectorList;
|
struct nsCSSSelectorList;
|
||||||
class nsDOMAttributeMap;
|
class nsDOMAttributeMap;
|
||||||
class nsIAnimationObserver;
|
class nsIAnimationObserver;
|
||||||
|
@ -1112,7 +1112,7 @@ public:
|
||||||
* @see nsIDOMNodeList
|
* @see nsIDOMNodeList
|
||||||
* @see nsGenericHTMLElement::GetChildNodes
|
* @see nsGenericHTMLElement::GetChildNodes
|
||||||
*/
|
*/
|
||||||
RefPtr<nsChildContentList> mChildNodes;
|
RefPtr<nsAttrChildContentList> mChildNodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weak reference to this node. This is cleared by the destructor of
|
* Weak reference to this node. This is cleared by the destructor of
|
||||||
|
|
Загрузка…
Ссылка в новой задаче