| 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 "JSSVGFEImageElement.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertInterface.h" |
| 28 | #include "JSDOMExceptionHandling.h" |
| 29 | #include "JSDOMGlobalObject.h" |
| 30 | #include "JSDOMWrapperCache.h" |
| 31 | #include "JSSVGAnimatedBoolean.h" |
| 32 | #include "JSSVGAnimatedLength.h" |
| 33 | #include "JSSVGAnimatedPreserveAspectRatio.h" |
| 34 | #include "JSSVGAnimatedString.h" |
| 35 | #include "ScriptExecutionContext.h" |
| 36 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 37 | #include <JavaScriptCore/JSCInlines.h> |
| 38 | #include <wtf/GetPtr.h> |
| 39 | #include <wtf/PointerPreparations.h> |
| 40 | #include <wtf/URL.h> |
| 41 | |
| 42 | |
| 43 | namespace WebCore { |
| 44 | using namespace JSC; |
| 45 | |
| 46 | // Attributes |
| 47 | |
| 48 | JSC::EncodedJSValue jsSVGFEImageElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 49 | bool setJSSVGFEImageElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 50 | JSC::EncodedJSValue jsSVGFEImageElementPreserveAspectRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsSVGFEImageElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | JSC::EncodedJSValue jsSVGFEImageElementX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 53 | JSC::EncodedJSValue jsSVGFEImageElementY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | JSC::EncodedJSValue jsSVGFEImageElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 55 | JSC::EncodedJSValue jsSVGFEImageElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | JSC::EncodedJSValue jsSVGFEImageElementResult(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 57 | JSC::EncodedJSValue jsSVGFEImageElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | |
| 59 | class JSSVGFEImageElementPrototype : public JSC::JSNonFinalObject { |
| 60 | public: |
| 61 | using Base = JSC::JSNonFinalObject; |
| 62 | static JSSVGFEImageElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 63 | { |
| 64 | JSSVGFEImageElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGFEImageElementPrototype>(vm.heap)) JSSVGFEImageElementPrototype(vm, globalObject, structure); |
| 65 | ptr->finishCreation(vm); |
| 66 | return ptr; |
| 67 | } |
| 68 | |
| 69 | DECLARE_INFO; |
| 70 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 71 | { |
| 72 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 73 | } |
| 74 | |
| 75 | private: |
| 76 | JSSVGFEImageElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 77 | : JSC::JSNonFinalObject(vm, structure) |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | void finishCreation(JSC::VM&); |
| 82 | }; |
| 83 | |
| 84 | using JSSVGFEImageElementConstructor = JSDOMConstructorNotConstructable<JSSVGFEImageElement>; |
| 85 | |
| 86 | template<> JSValue JSSVGFEImageElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 87 | { |
| 88 | return JSSVGElement::getConstructor(vm, &globalObject); |
| 89 | } |
| 90 | |
| 91 | template<> void JSSVGFEImageElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 92 | { |
| 93 | putDirect(vm, vm.propertyNames->prototype, JSSVGFEImageElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 94 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGFEImageElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 95 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 96 | } |
| 97 | |
| 98 | template<> const ClassInfo JSSVGFEImageElementConstructor::s_info = { "SVGFEImageElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFEImageElementConstructor) }; |
| 99 | |
| 100 | /* Hash table for prototype */ |
| 101 | |
| 102 | static const HashTableValue JSSVGFEImageElementPrototypeTableValues[] = |
| 103 | { |
| 104 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGFEImageElementConstructor) } }, |
| 105 | { "preserveAspectRatio" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementPreserveAspectRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 106 | { "externalResourcesRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 107 | { "x" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 108 | { "y" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 109 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 110 | { "height" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 111 | { "result" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementResult), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 112 | { "href" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFEImageElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 113 | }; |
| 114 | |
| 115 | const ClassInfo JSSVGFEImageElementPrototype::s_info = { "SVGFEImageElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFEImageElementPrototype) }; |
| 116 | |
| 117 | void JSSVGFEImageElementPrototype::finishCreation(VM& vm) |
| 118 | { |
| 119 | Base::finishCreation(vm); |
| 120 | reifyStaticProperties(vm, JSSVGFEImageElement::info(), JSSVGFEImageElementPrototypeTableValues, *this); |
| 121 | } |
| 122 | |
| 123 | const ClassInfo JSSVGFEImageElement::s_info = { "SVGFEImageElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFEImageElement) }; |
| 124 | |
| 125 | JSSVGFEImageElement::JSSVGFEImageElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGFEImageElement>&& impl) |
| 126 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
| 127 | { |
| 128 | } |
| 129 | |
| 130 | void JSSVGFEImageElement::finishCreation(VM& vm) |
| 131 | { |
| 132 | Base::finishCreation(vm); |
| 133 | ASSERT(inherits(vm, info())); |
| 134 | |
| 135 | } |
| 136 | |
| 137 | JSObject* JSSVGFEImageElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 138 | { |
| 139 | return JSSVGFEImageElementPrototype::create(vm, &globalObject, JSSVGFEImageElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
| 140 | } |
| 141 | |
| 142 | JSObject* JSSVGFEImageElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 143 | { |
| 144 | return getDOMPrototype<JSSVGFEImageElement>(vm, globalObject); |
| 145 | } |
| 146 | |
| 147 | JSValue JSSVGFEImageElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 148 | { |
| 149 | return getDOMConstructor<JSSVGFEImageElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 150 | } |
| 151 | |
| 152 | template<> inline JSSVGFEImageElement* IDLAttribute<JSSVGFEImageElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 153 | { |
| 154 | return jsDynamicCast<JSSVGFEImageElement*>(state.vm(), JSValue::decode(thisValue)); |
| 155 | } |
| 156 | |
| 157 | EncodedJSValue jsSVGFEImageElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 158 | { |
| 159 | VM& vm = state->vm(); |
| 160 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 161 | auto* prototype = jsDynamicCast<JSSVGFEImageElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 162 | if (UNLIKELY(!prototype)) |
| 163 | return throwVMTypeError(state, throwScope); |
| 164 | return JSValue::encode(JSSVGFEImageElement::getConstructor(state->vm(), prototype->globalObject())); |
| 165 | } |
| 166 | |
| 167 | bool setJSSVGFEImageElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 168 | { |
| 169 | VM& vm = state->vm(); |
| 170 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 171 | auto* prototype = jsDynamicCast<JSSVGFEImageElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 172 | if (UNLIKELY(!prototype)) { |
| 173 | throwVMTypeError(state, throwScope); |
| 174 | return false; |
| 175 | } |
| 176 | // Shadowing a built-in constructor |
| 177 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 178 | } |
| 179 | |
| 180 | static inline JSValue jsSVGFEImageElementPreserveAspectRatioGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 181 | { |
| 182 | UNUSED_PARAM(throwScope); |
| 183 | UNUSED_PARAM(state); |
| 184 | auto& impl = thisObject.wrapped(); |
| 185 | JSValue result = toJS<IDLInterface<SVGAnimatedPreserveAspectRatio>>(state, *thisObject.globalObject(), throwScope, impl.preserveAspectRatioAnimated()); |
| 186 | return result; |
| 187 | } |
| 188 | |
| 189 | EncodedJSValue jsSVGFEImageElementPreserveAspectRatio(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 190 | { |
| 191 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementPreserveAspectRatioGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "preserveAspectRatio" ); |
| 192 | } |
| 193 | |
| 194 | static inline JSValue jsSVGFEImageElementExternalResourcesRequiredGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 195 | { |
| 196 | UNUSED_PARAM(throwScope); |
| 197 | UNUSED_PARAM(state); |
| 198 | auto& impl = thisObject.wrapped(); |
| 199 | JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated()); |
| 200 | return result; |
| 201 | } |
| 202 | |
| 203 | EncodedJSValue jsSVGFEImageElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 204 | { |
| 205 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
| 206 | } |
| 207 | |
| 208 | static inline JSValue jsSVGFEImageElementXGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 209 | { |
| 210 | UNUSED_PARAM(throwScope); |
| 211 | UNUSED_PARAM(state); |
| 212 | auto& impl = thisObject.wrapped(); |
| 213 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.xAnimated()); |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | EncodedJSValue jsSVGFEImageElementX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 218 | { |
| 219 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x" ); |
| 220 | } |
| 221 | |
| 222 | static inline JSValue jsSVGFEImageElementYGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 223 | { |
| 224 | UNUSED_PARAM(throwScope); |
| 225 | UNUSED_PARAM(state); |
| 226 | auto& impl = thisObject.wrapped(); |
| 227 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.yAnimated()); |
| 228 | return result; |
| 229 | } |
| 230 | |
| 231 | EncodedJSValue jsSVGFEImageElementY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 232 | { |
| 233 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y" ); |
| 234 | } |
| 235 | |
| 236 | static inline JSValue jsSVGFEImageElementWidthGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 237 | { |
| 238 | UNUSED_PARAM(throwScope); |
| 239 | UNUSED_PARAM(state); |
| 240 | auto& impl = thisObject.wrapped(); |
| 241 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.widthAnimated()); |
| 242 | return result; |
| 243 | } |
| 244 | |
| 245 | EncodedJSValue jsSVGFEImageElementWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 246 | { |
| 247 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
| 248 | } |
| 249 | |
| 250 | static inline JSValue jsSVGFEImageElementHeightGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 251 | { |
| 252 | UNUSED_PARAM(throwScope); |
| 253 | UNUSED_PARAM(state); |
| 254 | auto& impl = thisObject.wrapped(); |
| 255 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.heightAnimated()); |
| 256 | return result; |
| 257 | } |
| 258 | |
| 259 | EncodedJSValue jsSVGFEImageElementHeight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 260 | { |
| 261 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "height" ); |
| 262 | } |
| 263 | |
| 264 | static inline JSValue jsSVGFEImageElementResultGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 265 | { |
| 266 | UNUSED_PARAM(throwScope); |
| 267 | UNUSED_PARAM(state); |
| 268 | auto& impl = thisObject.wrapped(); |
| 269 | JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.resultAnimated()); |
| 270 | return result; |
| 271 | } |
| 272 | |
| 273 | EncodedJSValue jsSVGFEImageElementResult(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 274 | { |
| 275 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementResultGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "result" ); |
| 276 | } |
| 277 | |
| 278 | static inline JSValue jsSVGFEImageElementHrefGetter(ExecState& state, JSSVGFEImageElement& thisObject, ThrowScope& throwScope) |
| 279 | { |
| 280 | UNUSED_PARAM(throwScope); |
| 281 | UNUSED_PARAM(state); |
| 282 | auto& impl = thisObject.wrapped(); |
| 283 | JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated()); |
| 284 | return result; |
| 285 | } |
| 286 | |
| 287 | EncodedJSValue jsSVGFEImageElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 288 | { |
| 289 | return IDLAttribute<JSSVGFEImageElement>::get<jsSVGFEImageElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href" ); |
| 290 | } |
| 291 | |
| 292 | void JSSVGFEImageElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 293 | { |
| 294 | auto* thisObject = jsCast<JSSVGFEImageElement*>(cell); |
| 295 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 296 | if (thisObject->scriptExecutionContext()) |
| 297 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 298 | Base::heapSnapshot(cell, builder); |
| 299 | } |
| 300 | |
| 301 | |
| 302 | } |
| 303 | |