diff options
Diffstat (limited to 'Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp')
-rw-r--r-- | Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index eecc08b0a..6c8c74d62 100644 --- a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -20,60 +20,34 @@ #include "config.h" #include "JSHTMLCollection.h" -#include "HTMLAllCollection.h" -#include "HTMLCollection.h" -#include "HTMLFormControlsCollection.h" -#include "HTMLOptionsCollection.h" #include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" #include "JSHTMLFormControlsCollection.h" #include "JSHTMLOptionsCollection.h" -#include "JSNode.h" -#include "JSNodeList.h" -#include "JSRadioNodeList.h" -#include "Node.h" -#include "RadioNodeList.h" -#include <wtf/Vector.h> -#include <wtf/text/AtomicString.h> using namespace JSC; namespace WebCore { -bool JSHTMLCollection::canGetItemsForName(ExecState*, HTMLCollection* collection, PropertyName propertyName) +JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<HTMLCollection>&& collection) { - return collection->hasNamedItem(propertyNameToAtomicString(propertyName)); -} - -EncodedJSValue JSHTMLCollection::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName) -{ - JSHTMLCollection* collection = jsCast<JSHTMLCollection*>(JSValue::decode(slotBase)); - const AtomicString& name = propertyNameToAtomicString(propertyName); - return JSValue::encode(toJS(exec, collection->globalObject(), collection->impl().namedItem(name))); -} - -JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection) -{ - if (!collection) - return jsNull(); - - JSObject* wrapper = getCachedWrapper(currentWorld(exec), collection); - - if (wrapper) - return wrapper; - switch (collection->type()) { case FormControls: - return CREATE_DOM_WRAPPER(exec, globalObject, HTMLFormControlsCollection, collection); + return createWrapper<HTMLFormControlsCollection>(globalObject, WTFMove(collection)); case SelectOptions: - return CREATE_DOM_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection); + return createWrapper<HTMLOptionsCollection>(globalObject, WTFMove(collection)); case DocAll: - return CREATE_DOM_WRAPPER(exec, globalObject, HTMLAllCollection, collection); + return createWrapper<HTMLAllCollection>(globalObject, WTFMove(collection)); default: break; } - return CREATE_DOM_WRAPPER(exec, globalObject, HTMLCollection, collection); + return createWrapper<HTMLCollection>(globalObject, WTFMove(collection)); +} + +JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, HTMLCollection& collection) +{ + return wrap(state, globalObject, collection); } } // namespace WebCore |