blob: 501a879a8eb6a9b5911ce7a20ea485dcc6cf24b1 [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "JSHTMLSlotElement.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include "JSNode.h"
#include "Node.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSArray.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
template<> Optional<HTMLSlotElement::AssignedNodesOptions> convertDictionary<HTMLSlotElement::AssignedNodesOptions>(ExecState& state, JSValue value)
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
if (value.isUndefinedOrNull())
return HTMLSlotElement::AssignedNodesOptions { false };
auto* object = value.getObject();
if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
throwTypeError(&state, throwScope);
return Nullopt;
}
auto flatten = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "flatten")), false);
return HTMLSlotElement::AssignedNodesOptions { WTFMove(flatten) };
}
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsHTMLSlotElementPrototypeFunctionAssignedNodes(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsHTMLSlotElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLSlotElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLSlotElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLSlotElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSHTMLSlotElementPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSHTMLSlotElementPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSHTMLSlotElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLSlotElementPrototype>(vm.heap)) JSHTMLSlotElementPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSHTMLSlotElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSHTMLSlotElement> JSHTMLSlotElementConstructor;
template<> JSValue JSHTMLSlotElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSHTMLElement::getConstructor(vm, &globalObject);
}
template<> void JSHTMLSlotElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSHTMLSlotElement::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("HTMLSlotElement"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSHTMLSlotElementConstructor::s_info = { "HTMLSlotElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLSlotElementConstructor) };
/* Hash table for prototype */
static const HashTableValue JSHTMLSlotElementPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSlotElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLSlotElementConstructor) } },
{ "name", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSlotElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLSlotElementName) } },
{ "assignedNodes", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsHTMLSlotElementPrototypeFunctionAssignedNodes), (intptr_t) (0) } },
};
const ClassInfo JSHTMLSlotElementPrototype::s_info = { "HTMLSlotElementPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLSlotElementPrototype) };
void JSHTMLSlotElementPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSHTMLSlotElementPrototypeTableValues, *this);
}
const ClassInfo JSHTMLSlotElement::s_info = { "HTMLSlotElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLSlotElement) };
JSHTMLSlotElement::JSHTMLSlotElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLSlotElement>&& impl)
: JSHTMLElement(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSHTMLSlotElement::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSHTMLSlotElementPrototype::create(vm, globalObject, JSHTMLSlotElementPrototype::createStructure(vm, globalObject, JSHTMLElement::prototype(vm, globalObject)));
}
JSObject* JSHTMLSlotElement::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSHTMLSlotElement>(vm, globalObject);
}
EncodedJSValue jsHTMLSlotElementName(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLSlotElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLSlotElement", "name");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.getNameAttribute());
return JSValue::encode(result);
}
EncodedJSValue jsHTMLSlotElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSHTMLSlotElementPrototype* domObject = jsDynamicCast<JSHTMLSlotElementPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSHTMLSlotElement::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSHTMLSlotElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSHTMLSlotElementPrototype* domObject = jsDynamicCast<JSHTMLSlotElementPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
bool setJSHTMLSlotElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLSlotElement* castedThis = jsDynamicCast<JSHTMLSlotElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLSlotElement", "name");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
return true;
}
JSValue JSHTMLSlotElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSHTMLSlotElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsHTMLSlotElementPrototypeFunctionAssignedNodes(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSHTMLSlotElement*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "HTMLSlotElement", "assignedNodes");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSHTMLSlotElement::info());
auto& impl = castedThis->wrapped();
auto options = state->argument(0).isUndefined() ? HTMLSlotElement::AssignedNodesOptions() : convertDictionary<HTMLSlotElement::AssignedNodesOptions>(*state, state->uncheckedArgument(0));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = jsArray(state, castedThis->globalObject(), impl.assignedNodes(options.value()));
return JSValue::encode(result);
}
void JSHTMLSlotElement::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSHTMLSlotElement*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->wrapped().visitJSEventListeners(visitor);
}
HTMLSlotElement* JSHTMLSlotElement::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSHTMLSlotElement*>(value))
return &wrapper->wrapped();
return nullptr;
}
}