diff options
author | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-16 00:04:39 +0000 |
---|---|---|
committer | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-16 00:04:39 +0000 |
commit | 33f9d91e3ab6f1bb28e28e7d1c390340e7963c18 (patch) | |
tree | 3a1c5fcf4a0d7dd04f757c05bfbccdd0edcffbc0 /webkit | |
parent | facc82690a523e5e97b6acda33863631eb2482d3 (diff) | |
download | chromium_src-33f9d91e3ab6f1bb28e28e7d1c390340e7963c18.zip chromium_src-33f9d91e3ab6f1bb28e28e7d1c390340e7963c18.tar.gz chromium_src-33f9d91e3ab6f1bb28e28e7d1c390340e7963c18.tar.bz2 |
Use the V8Bindings for HTMLSelectElementCollection and HTMLOptionsCollection in svn.webkit.org.
Review URL: http://codereview.chromium.org/115422
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 90 | ||||
-rw-r--r-- | webkit/webkit.gyp | 2 |
2 files changed, 2 insertions, 90 deletions
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index 27d1a81..9eafb38 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -30,7 +30,6 @@ #include "v8_binding.h" #include "V8NPObject.h" -#include "V8Attr.h" #include "V8CanvasGradient.h" #include "V8CanvasPattern.h" #include "V8CustomEventListener.h" @@ -39,7 +38,6 @@ #include "V8HTMLCanvasElement.h" #include "V8HTMLDocument.h" #include "V8HTMLImageElement.h" -#include "V8HTMLOptionElement.h" #include "V8NamedNodesCollection.h" #include "V8Node.h" #include "V8Proxy.h" @@ -71,13 +69,9 @@ #include "HTMLCanvasElement.h" #include "HTMLDocument.h" #include "HTMLEmbedElement.h" -#include "HTMLFrameSetElement.h" #include "HTMLImageElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "HTMLOptionElement.h" -#include "HTMLOptionsCollection.h" -#include "HTMLSelectElement.h" #include "History.h" #include "JSXPathNSResolver.h" #include "JSDOMBinding.h" @@ -149,90 +143,6 @@ ACCESSOR_GETTER(DocumentImplementation) { return wrapper; } - -INDEXED_PROPERTY_GETTER(HTMLOptionsCollection) { - INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertyGetter"); - HTMLOptionsCollection* collection = - V8Proxy::ToNativeObject<HTMLOptionsCollection>( - V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder()); - - RefPtr<Node> result = collection->item(index); - if (!result) return v8::Handle<v8::Value>(); - - return V8Proxy::NodeToV8Object(result.get()); -} - -static v8::Handle<v8::Value> OptionsCollectionSetter(uint32_t index, - v8::Handle<v8::Value> value, HTMLSelectElement* base) { - if (value->IsNull() || value->IsUndefined()) { - base->remove(index); - return value; - } - - ExceptionCode ec = 0; - - // Check that the value is an HTMLOptionElement. If not, throw a - // TYPE_MISMATCH_ERR DOMException. - if (!V8HTMLOptionElement::HasInstance(value)) { - V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); - return value; - } - - HTMLOptionElement* element = - V8Proxy::DOMWrapperToNode<HTMLOptionElement>( - v8::Handle<v8::Object>::Cast(value)); - base->setOption(index, element, ec); - - V8Proxy::SetDOMException(ec); - return value; -} - - -INDEXED_PROPERTY_SETTER(HTMLOptionsCollection) { - INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter"); - HTMLOptionsCollection* collection = - V8Proxy::ToNativeObject<HTMLOptionsCollection>( - V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder()); - HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->base()); - return OptionsCollectionSetter(index, value, base); -} - -NAMED_PROPERTY_GETTER(HTMLSelectElementCollection) { - INC_STATS("DOM.HTMLSelectElementCollection.NamedPropertySetter"); - HTMLSelectElement* select = - V8Proxy::DOMWrapperToNode<HTMLSelectElement>(info.Holder()); - v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); - - if (!value.IsEmpty()) - return value; - - // Search local callback properties next to find IDL defined - // properties. - if (info.Holder()->HasRealNamedCallbackProperty(name)) - return notHandledByInterceptor(); - - PassRefPtr<HTMLOptionsCollection> collection = select->options(); - - Vector<RefPtr<Node> > items; - collection->namedItems(v8StringToAtomicWebCoreString(name), items); - - if (!items.size()) - return v8::Handle<v8::Value>(); - - if (items.size() == 1) - return V8Proxy::NodeToV8Object(items.at(0).get()); - - NodeList* list = new V8NamedNodesCollection(items); - return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, list); -} - -INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection) { - INC_STATS("DOM.HTMLSelectElementCollection.IndexedPropertySetter"); - HTMLSelectElement* select = - V8Proxy::DOMWrapperToNode<HTMLSelectElement>(info.Holder()); - return OptionsCollectionSetter(index, value, select); -} - // CanvasRenderingContext2D ---------------------------------------------------- // Helper macro for converting v8 values into floats (expected by many of the diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index ac60041..c22e3e7 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -1025,6 +1025,7 @@ '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp', '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp', '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp', + '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp', '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp', '../third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.h', '../third_party/WebKit/WebCore/bindings/v8/custom/V8InspectorControllerCustom.cpp', @@ -1082,6 +1083,7 @@ '../third_party/WebKit/WebCore/bindings/v8/V8AbstractEventListener.cpp', '../third_party/WebKit/WebCore/bindings/v8/V8AbstractEventListener.h', '../third_party/WebKit/WebCore/bindings/v8/V8Binding.h', + '../third_party/WebKit/WebCore/bindings/v8/V8Collection.cpp', '../third_party/WebKit/WebCore/bindings/v8/V8Collection.h', '../third_party/WebKit/WebCore/bindings/v8/V8DOMMap.cpp', '../third_party/WebKit/WebCore/bindings/v8/V8DOMMap.h', |