mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 788532 (Add the new DOM bindings API to DOM lists) - Rename nsIDOMHTMLCollection::GetNodeAt to GetElementAt. r=bz.
--HG-- extra : rebase_source : 9bd26842a548580b7ea90a29d2fdba8629a70ef7
This commit is contained in:
parent
cc7dbc2506
commit
73a519e185
@ -619,10 +619,16 @@ nsContentList::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsGenericElement*
|
||||
nsContentList::GetElementAt(uint32_t aIndex)
|
||||
{
|
||||
return static_cast<nsGenericElement*>(Item(aIndex, true));
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsContentList::GetNodeAt(uint32_t aIndex)
|
||||
{
|
||||
return Item(aIndex, true);
|
||||
return GetElementAt(aIndex);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
|
@ -273,6 +273,8 @@ public:
|
||||
return mRootNode;
|
||||
}
|
||||
|
||||
virtual nsIContent* GetNodeAt(uint32_t aIndex);
|
||||
|
||||
// nsContentList public methods
|
||||
NS_HIDDEN_(uint32_t) Length(bool aDoFlush);
|
||||
NS_HIDDEN_(nsIContent*) Item(uint32_t aIndex, bool aDoFlush);
|
||||
|
@ -157,8 +157,8 @@ HTMLPropertiesCollection::GetNamedItem(const nsAString& aName,
|
||||
return static_cast<nsIDOMPropertyNodeList*>(propertyList);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
HTMLPropertiesCollection::GetNodeAt(uint32_t aIndex)
|
||||
nsGenericElement*
|
||||
HTMLPropertiesCollection::GetElementAt(uint32_t aIndex)
|
||||
{
|
||||
EnsureFresh();
|
||||
return mProperties.SafeElementAt(aIndex);
|
||||
|
@ -2215,7 +2215,7 @@ nsFormControlList::GetLength(uint32_t* aLength)
|
||||
NS_IMETHODIMP
|
||||
nsFormControlList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsISupports* item = GetNodeAt(aIndex);
|
||||
nsISupports* item = GetElementAt(aIndex);
|
||||
if (!item) {
|
||||
*aReturn = nullptr;
|
||||
|
||||
@ -2512,8 +2512,8 @@ nsFormControlList::GetSortedControls(nsTArray<nsGenericHTMLFormElement*>& aContr
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsFormControlList::GetNodeAt(uint32_t aIndex)
|
||||
nsGenericElement*
|
||||
nsFormControlList::GetElementAt(uint32_t aIndex)
|
||||
{
|
||||
FlushPendingNotifications();
|
||||
|
||||
|
@ -2106,7 +2106,7 @@ nsHTMLOptionCollection::SetSelectedIndex(int32_t aSelectedIndex)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOptionCollection::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsISupports* item = GetNodeAt(aIndex);
|
||||
nsISupports* item = GetElementAt(aIndex);
|
||||
if (!item) {
|
||||
*aReturn = nullptr;
|
||||
|
||||
@ -2116,10 +2116,10 @@ nsHTMLOptionCollection::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
return CallQueryInterface(item, aReturn);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHTMLOptionCollection::GetNodeAt(uint32_t aIndex)
|
||||
nsGenericElement*
|
||||
nsHTMLOptionCollection::GetElementAt(uint32_t aIndex)
|
||||
{
|
||||
return static_cast<nsIContent*>(ItemAsOption(aIndex));
|
||||
return ItemAsOption(aIndex);
|
||||
}
|
||||
|
||||
static nsHTMLOptionElement*
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// nsIDOMHTMLCollection interface, all its methods are defined in
|
||||
// nsIDOMHTMLOptionsCollection
|
||||
|
||||
virtual nsIContent* GetNodeAt(uint32_t aIndex);
|
||||
virtual nsGenericElement* GetElementAt(uint32_t aIndex);
|
||||
virtual nsINode* GetParentObject();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsHTMLOptionCollection,
|
||||
|
@ -191,7 +191,7 @@ TableRowsCollection::GetLength(uint32_t* 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 nsIContent*
|
||||
static nsGenericElement*
|
||||
GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
|
||||
uint32_t aIndex, uint32_t* aCount)
|
||||
{
|
||||
@ -200,20 +200,20 @@ GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
|
||||
if (rows) {
|
||||
rows->GetLength(aCount);
|
||||
if (aIndex < *aCount) {
|
||||
nsCOMPtr<nsINodeList> list = do_QueryInterface(rows);
|
||||
return list->GetNodeAt(aIndex);
|
||||
nsIHTMLCollection* list = static_cast<nsIHTMLCollection*>(rows);
|
||||
return list->GetElementAt(aIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
TableRowsCollection::GetNodeAt(uint32_t aIndex)
|
||||
nsGenericElement*
|
||||
TableRowsCollection::GetElementAt(uint32_t aIndex)
|
||||
{
|
||||
DO_FOR_EACH_ROWGROUP(
|
||||
uint32_t count;
|
||||
nsIContent* node = GetItemOrCountInRowGroup(rows, aIndex, &count);
|
||||
nsGenericElement* node = GetItemOrCountInRowGroup(rows, aIndex, &count);
|
||||
if (node) {
|
||||
return node;
|
||||
}
|
||||
@ -228,7 +228,7 @@ TableRowsCollection::GetNodeAt(uint32_t aIndex)
|
||||
NS_IMETHODIMP
|
||||
TableRowsCollection::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsISupports* node = GetNodeAt(aIndex);
|
||||
nsISupports* node = GetElementAt(aIndex);
|
||||
if (!node) {
|
||||
*aReturn = nullptr;
|
||||
|
||||
|
@ -147,7 +147,7 @@ nsHTMLTableRowElement::GetRowIndex(int32_t* aValue)
|
||||
rows->GetLength(&numRows);
|
||||
|
||||
for (uint32_t i = 0; i < numRows; i++) {
|
||||
if (rows->GetNodeAt(i) == static_cast<nsIContent*>(this)) {
|
||||
if (rows->GetElementAt(i) == this) {
|
||||
*aValue = i;
|
||||
break;
|
||||
}
|
||||
@ -170,7 +170,7 @@ nsHTMLTableRowElement::GetSectionRowIndex(int32_t* aValue)
|
||||
uint32_t numRows;
|
||||
rows->GetLength(&numRows);
|
||||
for (uint32_t i = 0; i < numRows; i++) {
|
||||
if (rows->GetNodeAt(i) == static_cast<nsIContent*>(this)) {
|
||||
if (rows->GetElementAt(i) == this) {
|
||||
*aValue = i;
|
||||
break;
|
||||
}
|
||||
|
@ -9592,7 +9592,7 @@ nsHTMLSelectElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext
|
||||
|
||||
nsHTMLOptionCollection *options = s->GetOptions();
|
||||
if (options) {
|
||||
nsISupports *node = options->GetNodeAt(n);
|
||||
nsISupports *node = options->GetElementAt(n);
|
||||
if (node) {
|
||||
*objp = obj;
|
||||
*_retval = JS_DefineElement(cx, obj, uint32_t(n), JSVAL_VOID, nullptr, nullptr,
|
||||
@ -9621,7 +9621,7 @@ nsHTMLSelectElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
nsHTMLOptionCollection *options = s->GetOptions();
|
||||
|
||||
if (options) {
|
||||
nsISupports *node = options->GetNodeAt(n);
|
||||
nsISupports *node = options->GetElementAt(n);
|
||||
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), node,
|
||||
&NS_GET_IID(nsIDOMNode), true, vp);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIContent;
|
||||
interface nsGenericElement;
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLCollection interface is an interface to a collection
|
||||
@ -18,18 +18,18 @@ interface nsIContent;
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(b7ccd7b3-86aa-4322-a50c-b972643bb662)]
|
||||
[scriptable, uuid(db690d8f-3bca-4198-be64-78adb7f38bf8)]
|
||||
interface nsIDOMHTMLCollection : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
[getter,forward(getNodeAt)] nsIDOMNode item(in unsigned long index);
|
||||
[getter,forward(getElementAt)] nsIDOMNode item(in unsigned long index);
|
||||
[getter,forward(getNamedItem)] nsIDOMNode namedItem(in DOMString name);
|
||||
|
||||
/**
|
||||
* Get the node at the index. Returns null if the index is out of bounds.
|
||||
*/
|
||||
[noscript,notxpcom,nostdcall] nsIContent getNodeAt(in unsigned long index);
|
||||
[noscript,notxpcom,nostdcall] nsGenericElement getElementAt(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Get the node for the name. Returns null if no node exists for the name.
|
||||
|
@ -8,21 +8,23 @@
|
||||
#include "nsIDOMPropertyNodeList.idl"
|
||||
#include "nsIDOMDOMStringList.idl"
|
||||
|
||||
interface nsGenericElement;
|
||||
|
||||
// This interface should extend nsIDOMHTMLCollection, which will be fixed when
|
||||
// it is converted to webidl.
|
||||
[scriptable, uuid(da1101db-d1d7-465d-9fd6-49ec9960cb20)]
|
||||
[scriptable, uuid(b7e84688-98e0-46b2-9d20-8a0e7329dd25)]
|
||||
interface nsIDOMHTMLPropertiesCollection : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long length;
|
||||
readonly attribute nsIDOMDOMStringList names;
|
||||
|
||||
[getter,forward(getNodeAt)] nsIDOMNode item(in unsigned long index);
|
||||
[getter,forward(getElementAt)] nsIDOMNode item(in unsigned long index);
|
||||
nsIDOMPropertyNodeList namedItem(in DOMString name);
|
||||
|
||||
/**
|
||||
* Get the node at the index. Returns null if the index is out of bounds.
|
||||
*/
|
||||
[noscript,notxpcom,nostdcall] nsIContent getNodeAt(in unsigned long index);
|
||||
[noscript,notxpcom,nostdcall] nsGenericElement getElementAt(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Get the node for the name. Returns null if no node exists for the name.
|
||||
|
Loading…
Reference in New Issue
Block a user