| 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 "JSSVGSymbolElement.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 "JSSVGAnimatedPreserveAspectRatio.h" |
| 33 | #include "JSSVGAnimatedRect.h" |
| 34 | #include "ScriptExecutionContext.h" |
| 35 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 36 | #include <JavaScriptCore/JSCInlines.h> |
| 37 | #include <wtf/GetPtr.h> |
| 38 | #include <wtf/PointerPreparations.h> |
| 39 | #include <wtf/URL.h> |
| 40 | |
| 41 | |
| 42 | namespace WebCore { |
| 43 | using namespace JSC; |
| 44 | |
| 45 | // Attributes |
| 46 | |
| 47 | JSC::EncodedJSValue jsSVGSymbolElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 48 | bool setJSSVGSymbolElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 49 | JSC::EncodedJSValue jsSVGSymbolElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 50 | JSC::EncodedJSValue jsSVGSymbolElementViewBox(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsSVGSymbolElementPreserveAspectRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | |
| 53 | class JSSVGSymbolElementPrototype : public JSC::JSNonFinalObject { |
| 54 | public: |
| 55 | using Base = JSC::JSNonFinalObject; |
| 56 | static JSSVGSymbolElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 57 | { |
| 58 | JSSVGSymbolElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGSymbolElementPrototype>(vm.heap)) JSSVGSymbolElementPrototype(vm, globalObject, structure); |
| 59 | ptr->finishCreation(vm); |
| 60 | return ptr; |
| 61 | } |
| 62 | |
| 63 | DECLARE_INFO; |
| 64 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 65 | { |
| 66 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 67 | } |
| 68 | |
| 69 | private: |
| 70 | JSSVGSymbolElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 71 | : JSC::JSNonFinalObject(vm, structure) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | void finishCreation(JSC::VM&); |
| 76 | }; |
| 77 | |
| 78 | using JSSVGSymbolElementConstructor = JSDOMConstructorNotConstructable<JSSVGSymbolElement>; |
| 79 | |
| 80 | template<> JSValue JSSVGSymbolElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 81 | { |
| 82 | return JSSVGElement::getConstructor(vm, &globalObject); |
| 83 | } |
| 84 | |
| 85 | template<> void JSSVGSymbolElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 86 | { |
| 87 | putDirect(vm, vm.propertyNames->prototype, JSSVGSymbolElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 88 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGSymbolElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 89 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 90 | } |
| 91 | |
| 92 | template<> const ClassInfo JSSVGSymbolElementConstructor::s_info = { "SVGSymbolElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGSymbolElementConstructor) }; |
| 93 | |
| 94 | /* Hash table for prototype */ |
| 95 | |
| 96 | static const HashTableValue JSSVGSymbolElementPrototypeTableValues[] = |
| 97 | { |
| 98 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGSymbolElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGSymbolElementConstructor) } }, |
| 99 | { "externalResourcesRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGSymbolElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 100 | { "viewBox" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGSymbolElementViewBox), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 101 | { "preserveAspectRatio" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGSymbolElementPreserveAspectRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 102 | }; |
| 103 | |
| 104 | const ClassInfo JSSVGSymbolElementPrototype::s_info = { "SVGSymbolElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGSymbolElementPrototype) }; |
| 105 | |
| 106 | void JSSVGSymbolElementPrototype::finishCreation(VM& vm) |
| 107 | { |
| 108 | Base::finishCreation(vm); |
| 109 | reifyStaticProperties(vm, JSSVGSymbolElement::info(), JSSVGSymbolElementPrototypeTableValues, *this); |
| 110 | } |
| 111 | |
| 112 | const ClassInfo JSSVGSymbolElement::s_info = { "SVGSymbolElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGSymbolElement) }; |
| 113 | |
| 114 | JSSVGSymbolElement::JSSVGSymbolElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGSymbolElement>&& impl) |
| 115 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
| 116 | { |
| 117 | } |
| 118 | |
| 119 | void JSSVGSymbolElement::finishCreation(VM& vm) |
| 120 | { |
| 121 | Base::finishCreation(vm); |
| 122 | ASSERT(inherits(vm, info())); |
| 123 | |
| 124 | } |
| 125 | |
| 126 | JSObject* JSSVGSymbolElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 127 | { |
| 128 | return JSSVGSymbolElementPrototype::create(vm, &globalObject, JSSVGSymbolElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
| 129 | } |
| 130 | |
| 131 | JSObject* JSSVGSymbolElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 132 | { |
| 133 | return getDOMPrototype<JSSVGSymbolElement>(vm, globalObject); |
| 134 | } |
| 135 | |
| 136 | JSValue JSSVGSymbolElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 137 | { |
| 138 | return getDOMConstructor<JSSVGSymbolElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 139 | } |
| 140 | |
| 141 | template<> inline JSSVGSymbolElement* IDLAttribute<JSSVGSymbolElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 142 | { |
| 143 | return jsDynamicCast<JSSVGSymbolElement*>(state.vm(), JSValue::decode(thisValue)); |
| 144 | } |
| 145 | |
| 146 | EncodedJSValue jsSVGSymbolElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 147 | { |
| 148 | VM& vm = state->vm(); |
| 149 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 150 | auto* prototype = jsDynamicCast<JSSVGSymbolElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 151 | if (UNLIKELY(!prototype)) |
| 152 | return throwVMTypeError(state, throwScope); |
| 153 | return JSValue::encode(JSSVGSymbolElement::getConstructor(state->vm(), prototype->globalObject())); |
| 154 | } |
| 155 | |
| 156 | bool setJSSVGSymbolElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 157 | { |
| 158 | VM& vm = state->vm(); |
| 159 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 160 | auto* prototype = jsDynamicCast<JSSVGSymbolElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 161 | if (UNLIKELY(!prototype)) { |
| 162 | throwVMTypeError(state, throwScope); |
| 163 | return false; |
| 164 | } |
| 165 | // Shadowing a built-in constructor |
| 166 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 167 | } |
| 168 | |
| 169 | static inline JSValue jsSVGSymbolElementExternalResourcesRequiredGetter(ExecState& state, JSSVGSymbolElement& thisObject, ThrowScope& throwScope) |
| 170 | { |
| 171 | UNUSED_PARAM(throwScope); |
| 172 | UNUSED_PARAM(state); |
| 173 | auto& impl = thisObject.wrapped(); |
| 174 | JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated()); |
| 175 | return result; |
| 176 | } |
| 177 | |
| 178 | EncodedJSValue jsSVGSymbolElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 179 | { |
| 180 | return IDLAttribute<JSSVGSymbolElement>::get<jsSVGSymbolElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
| 181 | } |
| 182 | |
| 183 | static inline JSValue jsSVGSymbolElementViewBoxGetter(ExecState& state, JSSVGSymbolElement& thisObject, ThrowScope& throwScope) |
| 184 | { |
| 185 | UNUSED_PARAM(throwScope); |
| 186 | UNUSED_PARAM(state); |
| 187 | auto& impl = thisObject.wrapped(); |
| 188 | JSValue result = toJS<IDLInterface<SVGAnimatedRect>>(state, *thisObject.globalObject(), throwScope, impl.viewBoxAnimated()); |
| 189 | return result; |
| 190 | } |
| 191 | |
| 192 | EncodedJSValue jsSVGSymbolElementViewBox(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 193 | { |
| 194 | return IDLAttribute<JSSVGSymbolElement>::get<jsSVGSymbolElementViewBoxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewBox" ); |
| 195 | } |
| 196 | |
| 197 | static inline JSValue jsSVGSymbolElementPreserveAspectRatioGetter(ExecState& state, JSSVGSymbolElement& thisObject, ThrowScope& throwScope) |
| 198 | { |
| 199 | UNUSED_PARAM(throwScope); |
| 200 | UNUSED_PARAM(state); |
| 201 | auto& impl = thisObject.wrapped(); |
| 202 | JSValue result = toJS<IDLInterface<SVGAnimatedPreserveAspectRatio>>(state, *thisObject.globalObject(), throwScope, impl.preserveAspectRatioAnimated()); |
| 203 | return result; |
| 204 | } |
| 205 | |
| 206 | EncodedJSValue jsSVGSymbolElementPreserveAspectRatio(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 207 | { |
| 208 | return IDLAttribute<JSSVGSymbolElement>::get<jsSVGSymbolElementPreserveAspectRatioGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "preserveAspectRatio" ); |
| 209 | } |
| 210 | |
| 211 | void JSSVGSymbolElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 212 | { |
| 213 | auto* thisObject = jsCast<JSSVGSymbolElement*>(cell); |
| 214 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 215 | if (thisObject->scriptExecutionContext()) |
| 216 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 217 | Base::heapSnapshot(cell, builder); |
| 218 | } |
| 219 | |
| 220 | |
| 221 | } |
| 222 | |