v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLSelectElement.NamedPropertyGetter");
    HTMLSelectElement* select = V8HTMLSelectElement::toNative(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 notHandledByInterceptor();

    if (items.size() == 1)
        return toV8(items.at(0).release());

    NodeList* list = new V8NamedNodesCollection(items);
    return toV8(list);
}
static v8::Handle<v8::Value> optionsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLSelectElement.options._get");
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(info.Holder());
	if (!R_check(imp)) return v8::Handle<v8::Value>(v8::Undefined());
    return toV8(imp->options());
}
Пример #3
0
HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options( 
        /* [retval][out] */ IDOMHTMLOptionsCollection** result)
{
    if (!result)
        return E_POINTER;

    ASSERT(m_element);
    HTMLSelectElement* selectElement = toHTMLSelectElement(m_element);

    if (!selectElement->options())
        return E_FAIL;

    *result = 0;
    RefPtr<HTMLOptionsCollection> options = selectElement->options();
    *result = DOMHTMLOptionsCollection::createInstance(options.get());
    return S_OK;
}
Пример #4
0
JSValue jsHTMLSelectElementOptions(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->options()));
    return result;
}
HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options( 
        /* [retval][out] */ IDOMHTMLOptionsCollection** result)
{
    if (!result)
        return E_POINTER;

    *result = 0;

    ASSERT(m_element);
    ASSERT(m_element->hasTagName(selectTag));
    HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);

    if (!selectElement->options())
        return E_FAIL;

    *result = DOMHTMLOptionsCollection::createInstance(selectElement->options().get());
    return S_OK;
}