| 1 | /* |
| 2 | This file is part of the WebKit open source project. |
| 3 | This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Library General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Library General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Library General Public License |
| 16 | along with this library; see the file COPYING.LIB. If not, write to |
| 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #include "config.h" |
| 22 | #include "JSSVGCursorElement.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertBoolean.h" |
| 28 | #include "JSDOMConvertInterface.h" |
| 29 | #include "JSDOMConvertStrings.h" |
| 30 | #include "JSDOMExceptionHandling.h" |
| 31 | #include "JSDOMGlobalObject.h" |
| 32 | #include "JSDOMOperation.h" |
| 33 | #include "JSDOMWrapperCache.h" |
| 34 | #include "JSSVGAnimatedBoolean.h" |
| 35 | #include "JSSVGAnimatedLength.h" |
| 36 | #include "JSSVGAnimatedString.h" |
| 37 | #include "JSSVGStringList.h" |
| 38 | #include "ScriptExecutionContext.h" |
| 39 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 40 | #include <JavaScriptCore/JSCInlines.h> |
| 41 | #include <wtf/GetPtr.h> |
| 42 | #include <wtf/PointerPreparations.h> |
| 43 | #include <wtf/URL.h> |
| 44 | |
| 45 | |
| 46 | namespace WebCore { |
| 47 | using namespace JSC; |
| 48 | |
| 49 | // Functions |
| 50 | |
| 51 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGCursorElementPrototypeFunctionHasExtension(JSC::ExecState*); |
| 52 | |
| 53 | // Attributes |
| 54 | |
| 55 | JSC::EncodedJSValue jsSVGCursorElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | bool setJSSVGCursorElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 57 | JSC::EncodedJSValue jsSVGCursorElementX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | JSC::EncodedJSValue jsSVGCursorElementY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 59 | JSC::EncodedJSValue jsSVGCursorElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 60 | JSC::EncodedJSValue jsSVGCursorElementRequiredFeatures(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 61 | JSC::EncodedJSValue jsSVGCursorElementRequiredExtensions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | JSC::EncodedJSValue jsSVGCursorElementSystemLanguage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 63 | JSC::EncodedJSValue jsSVGCursorElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | |
| 65 | class JSSVGCursorElementPrototype : public JSC::JSNonFinalObject { |
| 66 | public: |
| 67 | using Base = JSC::JSNonFinalObject; |
| 68 | static JSSVGCursorElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 69 | { |
| 70 | JSSVGCursorElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGCursorElementPrototype>(vm.heap)) JSSVGCursorElementPrototype(vm, globalObject, structure); |
| 71 | ptr->finishCreation(vm); |
| 72 | return ptr; |
| 73 | } |
| 74 | |
| 75 | DECLARE_INFO; |
| 76 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 77 | { |
| 78 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 79 | } |
| 80 | |
| 81 | private: |
| 82 | JSSVGCursorElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 83 | : JSC::JSNonFinalObject(vm, structure) |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | void finishCreation(JSC::VM&); |
| 88 | }; |
| 89 | |
| 90 | using JSSVGCursorElementConstructor = JSDOMConstructorNotConstructable<JSSVGCursorElement>; |
| 91 | |
| 92 | template<> JSValue JSSVGCursorElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 93 | { |
| 94 | return JSSVGElement::getConstructor(vm, &globalObject); |
| 95 | } |
| 96 | |
| 97 | template<> void JSSVGCursorElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 98 | { |
| 99 | putDirect(vm, vm.propertyNames->prototype, JSSVGCursorElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 100 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGCursorElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 101 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 102 | } |
| 103 | |
| 104 | template<> const ClassInfo JSSVGCursorElementConstructor::s_info = { "SVGCursorElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGCursorElementConstructor) }; |
| 105 | |
| 106 | /* Hash table for prototype */ |
| 107 | |
| 108 | static const HashTableValue JSSVGCursorElementPrototypeTableValues[] = |
| 109 | { |
| 110 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGCursorElementConstructor) } }, |
| 111 | { "x" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 112 | { "y" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 113 | { "externalResourcesRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 114 | { "requiredFeatures" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementRequiredFeatures), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 115 | { "requiredExtensions" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementRequiredExtensions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 116 | { "systemLanguage" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementSystemLanguage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 117 | { "href" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGCursorElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 118 | { "hasExtension" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGCursorElementPrototypeFunctionHasExtension), (intptr_t) (0) } }, |
| 119 | }; |
| 120 | |
| 121 | const ClassInfo JSSVGCursorElementPrototype::s_info = { "SVGCursorElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGCursorElementPrototype) }; |
| 122 | |
| 123 | void JSSVGCursorElementPrototype::finishCreation(VM& vm) |
| 124 | { |
| 125 | Base::finishCreation(vm); |
| 126 | reifyStaticProperties(vm, JSSVGCursorElement::info(), JSSVGCursorElementPrototypeTableValues, *this); |
| 127 | } |
| 128 | |
| 129 | const ClassInfo JSSVGCursorElement::s_info = { "SVGCursorElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGCursorElement) }; |
| 130 | |
| 131 | JSSVGCursorElement::JSSVGCursorElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGCursorElement>&& impl) |
| 132 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
| 133 | { |
| 134 | } |
| 135 | |
| 136 | void JSSVGCursorElement::finishCreation(VM& vm) |
| 137 | { |
| 138 | Base::finishCreation(vm); |
| 139 | ASSERT(inherits(vm, info())); |
| 140 | |
| 141 | } |
| 142 | |
| 143 | JSObject* JSSVGCursorElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 144 | { |
| 145 | return JSSVGCursorElementPrototype::create(vm, &globalObject, JSSVGCursorElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
| 146 | } |
| 147 | |
| 148 | JSObject* JSSVGCursorElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 149 | { |
| 150 | return getDOMPrototype<JSSVGCursorElement>(vm, globalObject); |
| 151 | } |
| 152 | |
| 153 | JSValue JSSVGCursorElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 154 | { |
| 155 | return getDOMConstructor<JSSVGCursorElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 156 | } |
| 157 | |
| 158 | template<> inline JSSVGCursorElement* IDLAttribute<JSSVGCursorElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 159 | { |
| 160 | return jsDynamicCast<JSSVGCursorElement*>(state.vm(), JSValue::decode(thisValue)); |
| 161 | } |
| 162 | |
| 163 | template<> inline JSSVGCursorElement* IDLOperation<JSSVGCursorElement>::cast(ExecState& state) |
| 164 | { |
| 165 | return jsDynamicCast<JSSVGCursorElement*>(state.vm(), state.thisValue()); |
| 166 | } |
| 167 | |
| 168 | EncodedJSValue jsSVGCursorElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 169 | { |
| 170 | VM& vm = state->vm(); |
| 171 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 172 | auto* prototype = jsDynamicCast<JSSVGCursorElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 173 | if (UNLIKELY(!prototype)) |
| 174 | return throwVMTypeError(state, throwScope); |
| 175 | return JSValue::encode(JSSVGCursorElement::getConstructor(state->vm(), prototype->globalObject())); |
| 176 | } |
| 177 | |
| 178 | bool setJSSVGCursorElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 179 | { |
| 180 | VM& vm = state->vm(); |
| 181 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 182 | auto* prototype = jsDynamicCast<JSSVGCursorElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 183 | if (UNLIKELY(!prototype)) { |
| 184 | throwVMTypeError(state, throwScope); |
| 185 | return false; |
| 186 | } |
| 187 | // Shadowing a built-in constructor |
| 188 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 189 | } |
| 190 | |
| 191 | static inline JSValue jsSVGCursorElementXGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 192 | { |
| 193 | UNUSED_PARAM(throwScope); |
| 194 | UNUSED_PARAM(state); |
| 195 | auto& impl = thisObject.wrapped(); |
| 196 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.xAnimated()); |
| 197 | return result; |
| 198 | } |
| 199 | |
| 200 | EncodedJSValue jsSVGCursorElementX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 201 | { |
| 202 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x" ); |
| 203 | } |
| 204 | |
| 205 | static inline JSValue jsSVGCursorElementYGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 206 | { |
| 207 | UNUSED_PARAM(throwScope); |
| 208 | UNUSED_PARAM(state); |
| 209 | auto& impl = thisObject.wrapped(); |
| 210 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.yAnimated()); |
| 211 | return result; |
| 212 | } |
| 213 | |
| 214 | EncodedJSValue jsSVGCursorElementY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 215 | { |
| 216 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y" ); |
| 217 | } |
| 218 | |
| 219 | static inline JSValue jsSVGCursorElementExternalResourcesRequiredGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 220 | { |
| 221 | UNUSED_PARAM(throwScope); |
| 222 | UNUSED_PARAM(state); |
| 223 | auto& impl = thisObject.wrapped(); |
| 224 | JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated()); |
| 225 | return result; |
| 226 | } |
| 227 | |
| 228 | EncodedJSValue jsSVGCursorElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 229 | { |
| 230 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
| 231 | } |
| 232 | |
| 233 | static inline JSValue jsSVGCursorElementRequiredFeaturesGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 234 | { |
| 235 | UNUSED_PARAM(throwScope); |
| 236 | UNUSED_PARAM(state); |
| 237 | auto& impl = thisObject.wrapped(); |
| 238 | JSValue result = toJS<IDLInterface<SVGStringList>>(state, *thisObject.globalObject(), throwScope, impl.requiredFeatures()); |
| 239 | return result; |
| 240 | } |
| 241 | |
| 242 | EncodedJSValue jsSVGCursorElementRequiredFeatures(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 243 | { |
| 244 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementRequiredFeaturesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "requiredFeatures" ); |
| 245 | } |
| 246 | |
| 247 | static inline JSValue jsSVGCursorElementRequiredExtensionsGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 248 | { |
| 249 | UNUSED_PARAM(throwScope); |
| 250 | UNUSED_PARAM(state); |
| 251 | auto& impl = thisObject.wrapped(); |
| 252 | JSValue result = toJS<IDLInterface<SVGStringList>>(state, *thisObject.globalObject(), throwScope, impl.requiredExtensions()); |
| 253 | return result; |
| 254 | } |
| 255 | |
| 256 | EncodedJSValue jsSVGCursorElementRequiredExtensions(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 257 | { |
| 258 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementRequiredExtensionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "requiredExtensions" ); |
| 259 | } |
| 260 | |
| 261 | static inline JSValue jsSVGCursorElementSystemLanguageGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 262 | { |
| 263 | UNUSED_PARAM(throwScope); |
| 264 | UNUSED_PARAM(state); |
| 265 | auto& impl = thisObject.wrapped(); |
| 266 | JSValue result = toJS<IDLInterface<SVGStringList>>(state, *thisObject.globalObject(), throwScope, impl.systemLanguage()); |
| 267 | return result; |
| 268 | } |
| 269 | |
| 270 | EncodedJSValue jsSVGCursorElementSystemLanguage(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 271 | { |
| 272 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementSystemLanguageGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "systemLanguage" ); |
| 273 | } |
| 274 | |
| 275 | static inline JSValue jsSVGCursorElementHrefGetter(ExecState& state, JSSVGCursorElement& thisObject, ThrowScope& throwScope) |
| 276 | { |
| 277 | UNUSED_PARAM(throwScope); |
| 278 | UNUSED_PARAM(state); |
| 279 | auto& impl = thisObject.wrapped(); |
| 280 | JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated()); |
| 281 | return result; |
| 282 | } |
| 283 | |
| 284 | EncodedJSValue jsSVGCursorElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 285 | { |
| 286 | return IDLAttribute<JSSVGCursorElement>::get<jsSVGCursorElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href" ); |
| 287 | } |
| 288 | |
| 289 | static inline JSC::EncodedJSValue jsSVGCursorElementPrototypeFunctionHasExtensionBody(JSC::ExecState* state, typename IDLOperation<JSSVGCursorElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 290 | { |
| 291 | UNUSED_PARAM(state); |
| 292 | UNUSED_PARAM(throwScope); |
| 293 | auto& impl = castedThis->wrapped(); |
| 294 | auto extension = convert<IDLDOMString>(*state, state->argument(0)); |
| 295 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 296 | return JSValue::encode(toJS<IDLBoolean>(impl.hasExtension(WTFMove(extension)))); |
| 297 | } |
| 298 | |
| 299 | EncodedJSValue JSC_HOST_CALL jsSVGCursorElementPrototypeFunctionHasExtension(ExecState* state) |
| 300 | { |
| 301 | return IDLOperation<JSSVGCursorElement>::call<jsSVGCursorElementPrototypeFunctionHasExtensionBody>(*state, "hasExtension" ); |
| 302 | } |
| 303 | |
| 304 | void JSSVGCursorElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 305 | { |
| 306 | auto* thisObject = jsCast<JSSVGCursorElement*>(cell); |
| 307 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 308 | if (thisObject->scriptExecutionContext()) |
| 309 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 310 | Base::heapSnapshot(cell, builder); |
| 311 | } |
| 312 | |
| 313 | |
| 314 | } |
| 315 | |