blob: 945ca5cd2e7a377ce4e72c933876c9c2a6c1b67e [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 "JSSVGPaint.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsSVGPaintPrototypeFunctionSetUri(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGPaintPrototypeFunctionSetPaint(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsSVGPaintPaintType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsSVGPaintUri(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsSVGPaintConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGPaintConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSSVGPaintPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSSVGPaintPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSSVGPaintPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGPaintPrototype>(vm.heap)) JSSVGPaintPrototype(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:
JSSVGPaintPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSSVGPaint> JSSVGPaintConstructor;
/* Hash table for constructor */
static const HashTableValue JSSVGPaintConstructorTableValues[] =
{
{ "SVG_PAINTTYPE_UNKNOWN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
{ "SVG_PAINTTYPE_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
{ "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
{ "SVG_PAINTTYPE_NONE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(101) } },
{ "SVG_PAINTTYPE_CURRENTCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(102) } },
{ "SVG_PAINTTYPE_URI_NONE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(103) } },
{ "SVG_PAINTTYPE_URI_CURRENTCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(104) } },
{ "SVG_PAINTTYPE_URI_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(105) } },
{ "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(106) } },
{ "SVG_PAINTTYPE_URI", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(107) } },
};
static_assert(SVGPaint::SVG_PAINTTYPE_UNKNOWN == 0, "SVG_PAINTTYPE_UNKNOWN in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_RGBCOLOR == 1, "SVG_PAINTTYPE_RGBCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR == 2, "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_NONE == 101, "SVG_PAINTTYPE_NONE in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR == 102, "SVG_PAINTTYPE_CURRENTCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_URI_NONE == 103, "SVG_PAINTTYPE_URI_NONE in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR == 104, "SVG_PAINTTYPE_URI_CURRENTCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR == 105, "SVG_PAINTTYPE_URI_RGBCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR == 106, "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR in SVGPaint does not match value from IDL");
static_assert(SVGPaint::SVG_PAINTTYPE_URI == 107, "SVG_PAINTTYPE_URI in SVGPaint does not match value from IDL");
template<> JSValue JSSVGPaintConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSSVGColor::getConstructor(vm, &globalObject);
}
template<> void JSSVGPaintConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSSVGPaint::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("SVGPaint"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
reifyStaticProperties(vm, JSSVGPaintConstructorTableValues, *this);
}
template<> const ClassInfo JSSVGPaintConstructor::s_info = { "SVGPaint", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGPaintConstructor) };
/* Hash table for prototype */
static const HashTableValue JSSVGPaintPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPaintConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPaintConstructor) } },
{ "paintType", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPaintPaintType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "uri", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPaintUri), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "setUri", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGPaintPrototypeFunctionSetUri), (intptr_t) (1) } },
{ "setPaint", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGPaintPrototypeFunctionSetPaint), (intptr_t) (4) } },
{ "SVG_PAINTTYPE_UNKNOWN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
{ "SVG_PAINTTYPE_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
{ "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
{ "SVG_PAINTTYPE_NONE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(101) } },
{ "SVG_PAINTTYPE_CURRENTCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(102) } },
{ "SVG_PAINTTYPE_URI_NONE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(103) } },
{ "SVG_PAINTTYPE_URI_CURRENTCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(104) } },
{ "SVG_PAINTTYPE_URI_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(105) } },
{ "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(106) } },
{ "SVG_PAINTTYPE_URI", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(107) } },
};
const ClassInfo JSSVGPaintPrototype::s_info = { "SVGPaintPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGPaintPrototype) };
void JSSVGPaintPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSSVGPaintPrototypeTableValues, *this);
}
const ClassInfo JSSVGPaint::s_info = { "SVGPaint", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGPaint) };
JSSVGPaint::JSSVGPaint(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGPaint>&& impl)
: JSSVGColor(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSSVGPaint::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSSVGPaintPrototype::create(vm, globalObject, JSSVGPaintPrototype::createStructure(vm, globalObject, JSSVGColor::prototype(vm, globalObject)));
}
JSObject* JSSVGPaint::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSSVGPaint>(vm, globalObject);
}
EncodedJSValue jsSVGPaintPaintType(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<JSSVGPaint*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGPaint", "paintType");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.paintType());
return JSValue::encode(result);
}
EncodedJSValue jsSVGPaintUri(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<JSSVGPaint*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGPaint", "uri");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.uri());
return JSValue::encode(result);
}
EncodedJSValue jsSVGPaintConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSSVGPaintPrototype* domObject = jsDynamicCast<JSSVGPaintPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSSVGPaint::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSSVGPaintConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSSVGPaintPrototype* domObject = jsDynamicCast<JSSVGPaintPrototype*>(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);
}
JSValue JSSVGPaint::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSSVGPaintConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsSVGPaintPrototypeFunctionSetUri(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGPaint*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGPaint", "setUri");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGPaint::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto uri = state->uncheckedArgument(0).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setUri(WTFMove(uri));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsSVGPaintPrototypeFunctionSetPaint(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGPaint*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGPaint", "setPaint");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGPaint::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 4))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto paintType = convert<uint16_t>(*state, state->uncheckedArgument(0), NormalConversion);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto uri = state->uncheckedArgument(1).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto rgbColor = state->uncheckedArgument(2).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto iccColor = state->uncheckedArgument(3).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setPaint(WTFMove(paintType), WTFMove(uri), WTFMove(rgbColor), WTFMove(iccColor), ec);
setDOMException(state, throwScope, ec);
return JSValue::encode(jsUndefined());
}
}