mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 968766 - Part e: Introduce HTMLAllCollection::Item; r=jst
This commit is contained in:
parent
c4958481bc
commit
d368c17b35
@ -87,6 +87,12 @@ HTMLAllCollection::Length()
|
||||
return Collection()->Length(true);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
HTMLAllCollection::Item(uint32_t aIndex)
|
||||
{
|
||||
return Collection()->Item(aIndex);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLAllCollection::GetObject(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
@ -216,9 +222,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> ob
|
||||
// Map document.all[n] (where n is a number) to the n:th item in
|
||||
// the document.all node list.
|
||||
|
||||
nsRefPtr<nsContentList> nodeList = doc->All()->Collection();
|
||||
|
||||
nsIContent *node = nodeList->Item(JSID_TO_INT(id));
|
||||
nsIContent* node = doc->All()->Item(SafeCast<uint32_t>(JSID_TO_INT(id)));
|
||||
|
||||
result = node;
|
||||
cache = node;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
class nsContentList;
|
||||
class nsHTMLDocument;
|
||||
class nsIContent;
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
@ -32,12 +33,13 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(HTMLAllCollection)
|
||||
|
||||
uint32_t Length();
|
||||
nsIContent* Item(uint32_t aIndex);
|
||||
|
||||
JSObject* GetObject(JSContext* aCx, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
nsContentList* Collection();
|
||||
|
||||
private:
|
||||
JS::Heap<JSObject*> mObject;
|
||||
nsRefPtr<nsHTMLDocument> mDocument;
|
||||
nsRefPtr<nsContentList> mCollection;
|
||||
|
Loading…
Reference in New Issue
Block a user