зеркало из https://github.com/mozilla/gecko-dev.git
Part 3 of fix for bug 564266 (DOMCI GetItemAt/GetNamedItem should return nsWrapperCache) - make GetNodeAt return nsIContent*. r=jst.
--HG-- extra : rebase_source : 4653ed3c0f67141bbace1b1973db4aca4b4d908d
This commit is contained in:
Родитель
cd9415a4ff
Коммит
a4953c4e2d
|
@ -586,7 +586,7 @@ nsContentList::GetNodeAt(PRUint32 aIndex)
|
|||
return Item(aIndex, PR_TRUE);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsIContent*
|
||||
nsContentList::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
{
|
||||
*aResult = NS_OK;
|
||||
|
|
|
@ -269,7 +269,7 @@ public:
|
|||
virtual PRInt32 IndexOf(nsIContent* aContent);
|
||||
|
||||
// nsIHTMLCollection
|
||||
virtual nsISupports* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
||||
|
||||
// nsContentList public methods
|
||||
|
|
|
@ -40,10 +40,12 @@
|
|||
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
|
||||
class nsIContent;
|
||||
|
||||
// IID for the nsIHTMLCollection interface
|
||||
#define NS_IHTMLCOLLECTION_IID \
|
||||
{ 0x5709485b, 0xc057, 0x4ba7, \
|
||||
{ 0x95, 0xbd, 0x98, 0xb7, 0x94, 0x4f, 0x13, 0xe7 } }
|
||||
{ 0x81e08958, 0x76e3, 0x4055, \
|
||||
{ 0xa0, 0xf3, 0xb3, 0x6b, 0x85, 0xfe, 0xed, 0x73 } }
|
||||
|
||||
/**
|
||||
* An internal interface that allows QI-less getting of nodes from HTML
|
||||
|
@ -57,7 +59,7 @@ public:
|
|||
/**
|
||||
* Get the node at the index. Returns null if the index is out of bounds.
|
||||
*/
|
||||
virtual nsISupports* GetNodeAt(PRUint32 aIndex, nsresult* aResult) = 0;
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the node for the name. Returns null if no node exists for the name.
|
||||
|
|
|
@ -102,14 +102,13 @@ public:
|
|||
// nsIDOMHTMLCollection interface
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
virtual nsISupports* GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
{
|
||||
FlushPendingNotifications();
|
||||
|
||||
*aResult = NS_OK;
|
||||
|
||||
// XXXbz this should start returning nsINode* or something!
|
||||
return static_cast<nsIFormControl*>(mElements.SafeElementAt(aIndex, nsnull));
|
||||
return mElements.SafeElementAt(aIndex, nsnull);
|
||||
}
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName, nsresult* aResult)
|
||||
{
|
||||
|
|
|
@ -1944,12 +1944,12 @@ nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
|||
return CallQueryInterface(item, aReturn);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsIContent*
|
||||
nsHTMLOptionCollection::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
|
||||
{
|
||||
*aResult = NS_OK;
|
||||
|
||||
return static_cast<Element*>(ItemAsOption(aIndex));
|
||||
return static_cast<nsIContent*>(ItemAsOption(aIndex));
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
// nsIDOMHTMLCollection interface, all its methods are defined in
|
||||
// nsIDOMHTMLOptionsCollection
|
||||
|
||||
virtual nsISupports* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHTMLOptionCollection,
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
virtual nsISupports* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
|
||||
virtual nsISupports* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
||||
|
||||
NS_IMETHOD ParentDestroyed();
|
||||
|
@ -275,7 +275,7 @@ TableRowsCollection::GetLength(PRUint32* aLength)
|
|||
// Returns the item at index aIndex if available. If null is returned,
|
||||
// then aCount will be set to the number of rows in this row collection.
|
||||
// Otherwise, the value of aCount is undefined.
|
||||
static nsINode*
|
||||
static nsIContent*
|
||||
GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
|
||||
PRUint32 aIndex, PRUint32* aCount)
|
||||
{
|
||||
|
@ -292,13 +292,13 @@ GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsIContent*
|
||||
TableRowsCollection::GetNodeAt(PRUint32 aIndex, nsresult *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
DO_FOR_EACH_ROWGROUP(
|
||||
PRUint32 count;
|
||||
nsINode* node = GetItemOrCountInRowGroup(rows, aIndex, &count);
|
||||
nsIContent* node = GetItemOrCountInRowGroup(rows, aIndex, &count);
|
||||
if (node) {
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -8216,7 +8216,9 @@ nsArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
// Make sure rv == NS_OK here, so GetItemAt implementations that never fail
|
||||
// don't have to set rv.
|
||||
rv = NS_OK;
|
||||
nsISupports* array_item = GetItemAt(GetNative(wrapper, obj), n, &rv);
|
||||
nsWrapperCache *cache = nsnull;
|
||||
nsISupports* array_item =
|
||||
GetItemAt(GetNative(wrapper, obj), n, &cache, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (array_item) {
|
||||
|
@ -8279,7 +8281,7 @@ nsNodeListSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
|
||||
nsISupports*
|
||||
nsNodeListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsINodeList* list = static_cast<nsINodeList*>(aNative);
|
||||
#ifdef DEBUG
|
||||
|
@ -8293,7 +8295,9 @@ nsNodeListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
}
|
||||
#endif
|
||||
|
||||
return list->GetNodeAt(aIndex);
|
||||
nsINode *node;
|
||||
*aCache = node = list->GetNodeAt(aIndex);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
@ -8356,11 +8360,12 @@ nsNamedArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
|
||||
nsISupports*
|
||||
nsNamedNodeMapSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsDOMAttributeMap* map = nsDOMAttributeMap::FromSupports(aNative);
|
||||
|
||||
nsINode *attr = map->GetItemAt(aIndex, aResult);
|
||||
nsINode *attr;
|
||||
*aCache = attr = map->GetItemAt(aIndex, aResult);
|
||||
return attr;
|
||||
}
|
||||
|
||||
|
@ -8400,7 +8405,7 @@ nsHTMLCollectionSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
|
||||
nsISupports*
|
||||
nsHTMLCollectionSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsIHTMLCollection* collection = static_cast<nsIHTMLCollection*>(aNative);
|
||||
#ifdef DEBUG
|
||||
|
@ -8414,7 +8419,9 @@ nsHTMLCollectionSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
}
|
||||
#endif
|
||||
|
||||
return collection->GetNodeAt(aIndex, aResult);
|
||||
nsINode *item;
|
||||
*aCache = item = collection->GetNodeAt(aIndex, aResult);
|
||||
return item;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
|
@ -8469,11 +8476,13 @@ nsContentListSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
|
||||
nsISupports*
|
||||
nsContentListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsContentList *list = nsContentList::FromSupports(aNative);
|
||||
|
||||
return list->GetNodeAt(aIndex, aResult);
|
||||
nsIContent *item;
|
||||
*aCache = item = list->GetNodeAt(aIndex, aResult);
|
||||
return item;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
|
@ -10032,7 +10041,7 @@ nsHTMLOptionsCollectionSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
|||
|
||||
nsISupports*
|
||||
nsPluginSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsPluginElement* plugin = nsPluginElement::FromSupports(aNative);
|
||||
|
||||
|
@ -10053,7 +10062,7 @@ nsPluginSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
|||
|
||||
nsISupports*
|
||||
nsPluginArraySH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsPluginArray* array = nsPluginArray::FromSupports(aNative);
|
||||
|
||||
|
@ -10074,7 +10083,7 @@ nsPluginArraySH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
|||
|
||||
nsISupports*
|
||||
nsMimeTypeArraySH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsMimeTypeArray* array = nsMimeTypeArray::FromSupports(aNative);
|
||||
|
||||
|
@ -10188,7 +10197,7 @@ nsMediaListSH::GetStringAt(nsISupports *aNative, PRInt32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsStyleSheetListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *rv)
|
||||
nsWrapperCache **aCache, nsresult *rv)
|
||||
{
|
||||
nsDOMStyleSheetList* list = nsDOMStyleSheetList::FromSupports(aNative);
|
||||
|
||||
|
@ -10200,7 +10209,7 @@ nsStyleSheetListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsCSSValueListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsDOMCSSValueList* list = nsDOMCSSValueList::FromSupports(aNative);
|
||||
|
||||
|
@ -10251,7 +10260,7 @@ nsCSSStyleDeclSH::GetStringAt(nsISupports *aNative, PRInt32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsCSSRuleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsICSSRuleList* list = static_cast<nsICSSRuleList*>(aNative);
|
||||
#ifdef DEBUG
|
||||
|
@ -10272,7 +10281,7 @@ nsCSSRuleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsClientRectListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsClientRectList* list = nsClientRectList::FromSupports(aNative);
|
||||
|
||||
|
@ -10283,7 +10292,7 @@ nsClientRectListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsPaintRequestListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsPaintRequestList* list = nsPaintRequestList::FromSupports(aNative);
|
||||
|
||||
|
@ -10295,7 +10304,7 @@ nsPaintRequestListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
|||
|
||||
nsISupports*
|
||||
nsTreeColumnsSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsTreeColumns* columns = nsTreeColumns::FromSupports(aNative);
|
||||
|
||||
|
@ -10824,7 +10833,7 @@ nsOfflineResourceListSH::GetStringAt(nsISupports *aNative, PRInt32 aIndex,
|
|||
// nsFileListSH
|
||||
nsISupports*
|
||||
nsFileListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsDOMFileList* list = nsDOMFileList::FromSupports(aNative);
|
||||
|
||||
|
|
|
@ -727,7 +727,7 @@ protected:
|
|||
// Subclasses need to override this, if the implementation can't fail it's
|
||||
// allowed to not set *aResult.
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult) = 0;
|
||||
nsWrapperCache **aCache, nsresult *aResult) = 0;
|
||||
|
||||
public:
|
||||
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
@ -755,7 +755,7 @@ public:
|
|||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
|
@ -805,7 +805,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -836,7 +836,7 @@ protected:
|
|||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -867,7 +867,7 @@ public:
|
|||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsresult *aResult);
|
||||
|
@ -1151,7 +1151,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -1180,7 +1180,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -1209,7 +1209,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -1361,7 +1361,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1385,7 +1385,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1436,7 +1436,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1459,7 +1459,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1483,7 +1483,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1508,7 +1508,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
|
@ -1548,7 +1548,7 @@ protected:
|
|||
jsid *idp, PRBool *_retval);
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -1608,7 +1608,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult)
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -1754,7 +1754,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsresult *aResult);
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
|
Загрузка…
Ссылка в новой задаче