| /* |
| 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 "JSCSSPrimitiveValue.h" |
| |
| #include "Counter.h" |
| #include "ExceptionCode.h" |
| #include "JSCounter.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "JSRGBColor.h" |
| #include "JSRect.h" |
| #include "RGBColor.h" |
| #include "Rect.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 jsCSSPrimitiveValuePrototypeFunctionSetFloatValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetFloatValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionSetStringValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetStringValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetCounterValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetRectValue(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetRGBColorValue(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsCSSPrimitiveValuePrimitiveType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsCSSPrimitiveValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSCSSPrimitiveValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSCSSPrimitiveValuePrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSCSSPrimitiveValuePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSCSSPrimitiveValuePrototype* ptr = new (NotNull, JSC::allocateCell<JSCSSPrimitiveValuePrototype>(vm.heap)) JSCSSPrimitiveValuePrototype(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: |
| JSCSSPrimitiveValuePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSCSSPrimitiveValue> JSCSSPrimitiveValueConstructor; |
| |
| /* Hash table for constructor */ |
| |
| static const HashTableValue JSCSSPrimitiveValueConstructorTableValues[] = |
| { |
| { "CSS_UNKNOWN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "CSS_NUMBER", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "CSS_PERCENTAGE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| { "CSS_EMS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| { "CSS_EXS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
| { "CSS_PX", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
| { "CSS_CM", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
| { "CSS_MM", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
| { "CSS_IN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
| { "CSS_PT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
| { "CSS_PC", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
| { "CSS_DEG", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(11) } }, |
| { "CSS_RAD", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(12) } }, |
| { "CSS_GRAD", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(13) } }, |
| { "CSS_MS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(14) } }, |
| { "CSS_S", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(15) } }, |
| { "CSS_HZ", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(16) } }, |
| { "CSS_KHZ", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(17) } }, |
| { "CSS_DIMENSION", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(18) } }, |
| { "CSS_STRING", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(19) } }, |
| { "CSS_URI", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(20) } }, |
| { "CSS_IDENT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(21) } }, |
| { "CSS_ATTR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(22) } }, |
| { "CSS_COUNTER", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(23) } }, |
| { "CSS_RECT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(24) } }, |
| { "CSS_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(25) } }, |
| { "CSS_VW", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(26) } }, |
| { "CSS_VH", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(27) } }, |
| { "CSS_VMIN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(28) } }, |
| { "CSS_VMAX", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(29) } }, |
| }; |
| |
| static_assert(CSSPrimitiveValue::CSS_UNKNOWN == 0, "CSS_UNKNOWN in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_NUMBER == 1, "CSS_NUMBER in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_PERCENTAGE == 2, "CSS_PERCENTAGE in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_EMS == 3, "CSS_EMS in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_EXS == 4, "CSS_EXS in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_PX == 5, "CSS_PX in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_CM == 6, "CSS_CM in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_MM == 7, "CSS_MM in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_IN == 8, "CSS_IN in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_PT == 9, "CSS_PT in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_PC == 10, "CSS_PC in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_DEG == 11, "CSS_DEG in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_RAD == 12, "CSS_RAD in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_GRAD == 13, "CSS_GRAD in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_MS == 14, "CSS_MS in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_S == 15, "CSS_S in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_HZ == 16, "CSS_HZ in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_KHZ == 17, "CSS_KHZ in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_DIMENSION == 18, "CSS_DIMENSION in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_STRING == 19, "CSS_STRING in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_URI == 20, "CSS_URI in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_IDENT == 21, "CSS_IDENT in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_ATTR == 22, "CSS_ATTR in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_COUNTER == 23, "CSS_COUNTER in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_RECT == 24, "CSS_RECT in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_RGBCOLOR == 25, "CSS_RGBCOLOR in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_VW == 26, "CSS_VW in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_VH == 27, "CSS_VH in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_VMIN == 28, "CSS_VMIN in CSSPrimitiveValue does not match value from IDL"); |
| static_assert(CSSPrimitiveValue::CSS_VMAX == 29, "CSS_VMAX in CSSPrimitiveValue does not match value from IDL"); |
| |
| template<> JSValue JSCSSPrimitiveValueConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSCSSValue::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSCSSPrimitiveValueConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSCSSPrimitiveValue::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("CSSPrimitiveValue"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| reifyStaticProperties(vm, JSCSSPrimitiveValueConstructorTableValues, *this); |
| } |
| |
| template<> const ClassInfo JSCSSPrimitiveValueConstructor::s_info = { "CSSPrimitiveValue", &Base::s_info, 0, CREATE_METHOD_TABLE(JSCSSPrimitiveValueConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSCSSPrimitiveValuePrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSPrimitiveValueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSPrimitiveValueConstructor) } }, |
| { "primitiveType", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSPrimitiveValuePrimitiveType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "setFloatValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionSetFloatValue), (intptr_t) (0) } }, |
| { "getFloatValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionGetFloatValue), (intptr_t) (0) } }, |
| { "setStringValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionSetStringValue), (intptr_t) (0) } }, |
| { "getStringValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionGetStringValue), (intptr_t) (0) } }, |
| { "getCounterValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionGetCounterValue), (intptr_t) (0) } }, |
| { "getRectValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionGetRectValue), (intptr_t) (0) } }, |
| { "getRGBColorValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsCSSPrimitiveValuePrototypeFunctionGetRGBColorValue), (intptr_t) (0) } }, |
| { "CSS_UNKNOWN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "CSS_NUMBER", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "CSS_PERCENTAGE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| { "CSS_EMS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| { "CSS_EXS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
| { "CSS_PX", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
| { "CSS_CM", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
| { "CSS_MM", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
| { "CSS_IN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
| { "CSS_PT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
| { "CSS_PC", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
| { "CSS_DEG", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(11) } }, |
| { "CSS_RAD", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(12) } }, |
| { "CSS_GRAD", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(13) } }, |
| { "CSS_MS", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(14) } }, |
| { "CSS_S", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(15) } }, |
| { "CSS_HZ", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(16) } }, |
| { "CSS_KHZ", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(17) } }, |
| { "CSS_DIMENSION", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(18) } }, |
| { "CSS_STRING", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(19) } }, |
| { "CSS_URI", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(20) } }, |
| { "CSS_IDENT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(21) } }, |
| { "CSS_ATTR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(22) } }, |
| { "CSS_COUNTER", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(23) } }, |
| { "CSS_RECT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(24) } }, |
| { "CSS_RGBCOLOR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(25) } }, |
| { "CSS_VW", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(26) } }, |
| { "CSS_VH", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(27) } }, |
| { "CSS_VMIN", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(28) } }, |
| { "CSS_VMAX", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(29) } }, |
| }; |
| |
| const ClassInfo JSCSSPrimitiveValuePrototype::s_info = { "CSSPrimitiveValuePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSCSSPrimitiveValuePrototype) }; |
| |
| void JSCSSPrimitiveValuePrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSCSSPrimitiveValuePrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSCSSPrimitiveValue::s_info = { "CSSPrimitiveValue", &Base::s_info, 0, CREATE_METHOD_TABLE(JSCSSPrimitiveValue) }; |
| |
| JSCSSPrimitiveValue::JSCSSPrimitiveValue(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CSSPrimitiveValue>&& impl) |
| : JSCSSValue(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSCSSPrimitiveValue::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSCSSPrimitiveValuePrototype::create(vm, globalObject, JSCSSPrimitiveValuePrototype::createStructure(vm, globalObject, JSCSSValue::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSCSSPrimitiveValue::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSCSSPrimitiveValue>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsCSSPrimitiveValuePrimitiveType(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<JSCSSPrimitiveValue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "CSSPrimitiveValue", "primitiveType"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.primitiveType()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsCSSPrimitiveValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSCSSPrimitiveValuePrototype* domObject = jsDynamicCast<JSCSSPrimitiveValuePrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSCSSPrimitiveValue::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSCSSPrimitiveValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSCSSPrimitiveValuePrototype* domObject = jsDynamicCast<JSCSSPrimitiveValuePrototype*>(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 JSCSSPrimitiveValue::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSCSSPrimitiveValueConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionSetFloatValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "setFloatValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto unitType = convert<uint16_t>(*state, state->argument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto floatValue = convert<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.setFloatValue(WTFMove(unitType), WTFMove(floatValue), ec); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetFloatValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "getFloatValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto unitType = convert<uint16_t>(*state, state->argument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| JSValue result = jsNumber(impl.getFloatValue(WTFMove(unitType), ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionSetStringValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "setStringValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto stringType = convert<uint16_t>(*state, state->argument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto stringValue = state->argument(1).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.setStringValue(WTFMove(stringType), WTFMove(stringValue), ec); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetStringValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "getStringValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| JSValue result = jsStringWithCache(state, impl.getStringValue(ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetCounterValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "getCounterValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| JSValue result = toJS(state, castedThis->globalObject(), impl.getCounterValue(ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetRectValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "getRectValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| JSValue result = toJS(state, castedThis->globalObject(), impl.getRectValue(ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetRGBColorValue(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSCSSPrimitiveValue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "CSSPrimitiveValue", "getRGBColorValue"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSCSSPrimitiveValue::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| JSValue result = toJS(state, castedThis->globalObject(), impl.getRGBColorValue(ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| } |