diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp index 670b36cbadd..c0383741326 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp @@ -29,10 +29,10 @@ */ #include "config.h" -#include "V8HTMLAllCollection.h" +#include "bindings/core/v8/V8HTMLAllCollection.h" -#include "V8Node.h" -#include "V8NodeList.h" +#include "bindings/core/v8/V8Element.h" +#include "bindings/core/v8/V8NodeList.h" #include "bindings/v8/V8Binding.h" #include "core/dom/NamedNodesCollection.h" #include "core/html/HTMLAllCollection.h" @@ -43,7 +43,7 @@ namespace WebCore { template<class CallbackInfo> static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name, const CallbackInfo& info) { - Vector<RefPtr<Node> > namedItems; + WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; collection->namedItems(name, namedItems); if (!namedItems.size()) @@ -62,7 +62,7 @@ static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v { v8::Local<v8::Uint32> index = argument->ToArrayIndex(); if (index.IsEmpty()) { - V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, name, argument, v8::Undefined(info.GetIsolate())); + TOSTRING_DEFAULT(V8StringResource<>, name, argument, v8::Undefined(info.GetIsolate())); v8::Handle<v8::Value> result = getNamedItems(collection, name, info); if (result.IsEmpty()) @@ -71,29 +71,14 @@ static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v return result; } - RefPtr<Node> result = collection->item(index->Uint32Value()); + RefPtrWillBeRawPtr<Element> result = collection->item(index->Uint32Value()); return toV8(result.release(), info.Holder(), info.GetIsolate()); } void V8HTMLAllCollection::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) { - HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder()); - v8SetReturnValue(info, getItem(imp, info[0], info)); -} - -void V8HTMLAllCollection::namedItemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) -{ - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); - - HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder()); - v8::Handle<v8::Value> result = getNamedItems(imp, name, info); - - if (result.IsEmpty()) { - v8SetReturnValueNull(info); - return; - } - - v8SetReturnValue(info, result); + HTMLAllCollection* impl = V8HTMLAllCollection::toNative(info.Holder()); + v8SetReturnValue(info, getItem(impl, info[0], info)); } void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& info) @@ -101,25 +86,24 @@ void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va if (info.Length() < 1) return; - HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder()); - Node* ownerNode = imp->ownerNode(); - ASSERT(ownerNode); + HTMLAllCollection* impl = V8HTMLAllCollection::toNative(info.Holder()); + Node& ownerNode = impl->ownerNode(); - UseCounter::count(ownerNode->document(), UseCounter::DocumentAllLegacyCall); + UseCounter::count(ownerNode.document(), UseCounter::DocumentAllLegacyCall); if (info.Length() == 1) { - v8SetReturnValue(info, getItem(imp, info[0], info)); + v8SetReturnValue(info, getItem(impl, info[0], info)); return; } // If there is a second argument it is the index of the item we want. - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); + TOSTRING_VOID(V8StringResource<>, name, info[0]); v8::Local<v8::Uint32> index = info[1]->ToArrayIndex(); if (index.IsEmpty()) return; - if (Node* node = imp->namedItemWithIndex(name, index->Uint32Value())) { - v8SetReturnValueFast(info, node, imp); + if (Node* node = impl->namedItemWithIndex(name, index->Uint32Value())) { + v8SetReturnValueFast(info, node, impl); return; } } |