| 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 "JSSVGTextPositioningElement.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 "JSSVGAnimatedLengthList.h" |
| 32 | #include "JSSVGAnimatedNumberList.h" |
| 33 | #include "ScriptExecutionContext.h" |
| 34 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 35 | #include <JavaScriptCore/JSCInlines.h> |
| 36 | #include <wtf/GetPtr.h> |
| 37 | #include <wtf/PointerPreparations.h> |
| 38 | #include <wtf/URL.h> |
| 39 | |
| 40 | |
| 41 | namespace WebCore { |
| 42 | using namespace JSC; |
| 43 | |
| 44 | // Attributes |
| 45 | |
| 46 | JSC::EncodedJSValue jsSVGTextPositioningElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 47 | bool setJSSVGTextPositioningElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 48 | JSC::EncodedJSValue jsSVGTextPositioningElementX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 49 | JSC::EncodedJSValue jsSVGTextPositioningElementY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 50 | JSC::EncodedJSValue jsSVGTextPositioningElementDx(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsSVGTextPositioningElementDy(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | JSC::EncodedJSValue jsSVGTextPositioningElementRotate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 53 | |
| 54 | class JSSVGTextPositioningElementPrototype : public JSC::JSNonFinalObject { |
| 55 | public: |
| 56 | using Base = JSC::JSNonFinalObject; |
| 57 | static JSSVGTextPositioningElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 58 | { |
| 59 | JSSVGTextPositioningElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGTextPositioningElementPrototype>(vm.heap)) JSSVGTextPositioningElementPrototype(vm, globalObject, structure); |
| 60 | ptr->finishCreation(vm); |
| 61 | return ptr; |
| 62 | } |
| 63 | |
| 64 | DECLARE_INFO; |
| 65 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 66 | { |
| 67 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 68 | } |
| 69 | |
| 70 | private: |
| 71 | JSSVGTextPositioningElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 72 | : JSC::JSNonFinalObject(vm, structure) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | void finishCreation(JSC::VM&); |
| 77 | }; |
| 78 | |
| 79 | using JSSVGTextPositioningElementConstructor = JSDOMConstructorNotConstructable<JSSVGTextPositioningElement>; |
| 80 | |
| 81 | template<> JSValue JSSVGTextPositioningElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 82 | { |
| 83 | return JSSVGTextContentElement::getConstructor(vm, &globalObject); |
| 84 | } |
| 85 | |
| 86 | template<> void JSSVGTextPositioningElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 87 | { |
| 88 | putDirect(vm, vm.propertyNames->prototype, JSSVGTextPositioningElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 89 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGTextPositioningElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 90 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 91 | } |
| 92 | |
| 93 | template<> const ClassInfo JSSVGTextPositioningElementConstructor::s_info = { "SVGTextPositioningElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPositioningElementConstructor) }; |
| 94 | |
| 95 | /* Hash table for prototype */ |
| 96 | |
| 97 | static const HashTableValue JSSVGTextPositioningElementPrototypeTableValues[] = |
| 98 | { |
| 99 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGTextPositioningElementConstructor) } }, |
| 100 | { "x" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 101 | { "y" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 102 | { "dx" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementDx), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 103 | { "dy" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementDy), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 104 | { "rotate" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPositioningElementRotate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 105 | }; |
| 106 | |
| 107 | const ClassInfo JSSVGTextPositioningElementPrototype::s_info = { "SVGTextPositioningElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPositioningElementPrototype) }; |
| 108 | |
| 109 | void JSSVGTextPositioningElementPrototype::finishCreation(VM& vm) |
| 110 | { |
| 111 | Base::finishCreation(vm); |
| 112 | reifyStaticProperties(vm, JSSVGTextPositioningElement::info(), JSSVGTextPositioningElementPrototypeTableValues, *this); |
| 113 | } |
| 114 | |
| 115 | const ClassInfo JSSVGTextPositioningElement::s_info = { "SVGTextPositioningElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPositioningElement) }; |
| 116 | |
| 117 | JSSVGTextPositioningElement::JSSVGTextPositioningElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGTextPositioningElement>&& impl) |
| 118 | : JSSVGTextContentElement(structure, globalObject, WTFMove(impl)) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | void JSSVGTextPositioningElement::finishCreation(VM& vm) |
| 123 | { |
| 124 | Base::finishCreation(vm); |
| 125 | ASSERT(inherits(vm, info())); |
| 126 | |
| 127 | } |
| 128 | |
| 129 | JSObject* JSSVGTextPositioningElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 130 | { |
| 131 | return JSSVGTextPositioningElementPrototype::create(vm, &globalObject, JSSVGTextPositioningElementPrototype::createStructure(vm, &globalObject, JSSVGTextContentElement::prototype(vm, globalObject))); |
| 132 | } |
| 133 | |
| 134 | JSObject* JSSVGTextPositioningElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 135 | { |
| 136 | return getDOMPrototype<JSSVGTextPositioningElement>(vm, globalObject); |
| 137 | } |
| 138 | |
| 139 | JSValue JSSVGTextPositioningElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 140 | { |
| 141 | return getDOMConstructor<JSSVGTextPositioningElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 142 | } |
| 143 | |
| 144 | template<> inline JSSVGTextPositioningElement* IDLAttribute<JSSVGTextPositioningElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 145 | { |
| 146 | return jsDynamicCast<JSSVGTextPositioningElement*>(state.vm(), JSValue::decode(thisValue)); |
| 147 | } |
| 148 | |
| 149 | EncodedJSValue jsSVGTextPositioningElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 150 | { |
| 151 | VM& vm = state->vm(); |
| 152 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 153 | auto* prototype = jsDynamicCast<JSSVGTextPositioningElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 154 | if (UNLIKELY(!prototype)) |
| 155 | return throwVMTypeError(state, throwScope); |
| 156 | return JSValue::encode(JSSVGTextPositioningElement::getConstructor(state->vm(), prototype->globalObject())); |
| 157 | } |
| 158 | |
| 159 | bool setJSSVGTextPositioningElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 160 | { |
| 161 | VM& vm = state->vm(); |
| 162 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 163 | auto* prototype = jsDynamicCast<JSSVGTextPositioningElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 164 | if (UNLIKELY(!prototype)) { |
| 165 | throwVMTypeError(state, throwScope); |
| 166 | return false; |
| 167 | } |
| 168 | // Shadowing a built-in constructor |
| 169 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 170 | } |
| 171 | |
| 172 | static inline JSValue jsSVGTextPositioningElementXGetter(ExecState& state, JSSVGTextPositioningElement& thisObject, ThrowScope& throwScope) |
| 173 | { |
| 174 | UNUSED_PARAM(throwScope); |
| 175 | UNUSED_PARAM(state); |
| 176 | auto& impl = thisObject.wrapped(); |
| 177 | JSValue result = toJS<IDLInterface<SVGAnimatedLengthList>>(state, *thisObject.globalObject(), throwScope, impl.xAnimated()); |
| 178 | return result; |
| 179 | } |
| 180 | |
| 181 | EncodedJSValue jsSVGTextPositioningElementX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 182 | { |
| 183 | return IDLAttribute<JSSVGTextPositioningElement>::get<jsSVGTextPositioningElementXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x" ); |
| 184 | } |
| 185 | |
| 186 | static inline JSValue jsSVGTextPositioningElementYGetter(ExecState& state, JSSVGTextPositioningElement& thisObject, ThrowScope& throwScope) |
| 187 | { |
| 188 | UNUSED_PARAM(throwScope); |
| 189 | UNUSED_PARAM(state); |
| 190 | auto& impl = thisObject.wrapped(); |
| 191 | JSValue result = toJS<IDLInterface<SVGAnimatedLengthList>>(state, *thisObject.globalObject(), throwScope, impl.yAnimated()); |
| 192 | return result; |
| 193 | } |
| 194 | |
| 195 | EncodedJSValue jsSVGTextPositioningElementY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 196 | { |
| 197 | return IDLAttribute<JSSVGTextPositioningElement>::get<jsSVGTextPositioningElementYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y" ); |
| 198 | } |
| 199 | |
| 200 | static inline JSValue jsSVGTextPositioningElementDxGetter(ExecState& state, JSSVGTextPositioningElement& thisObject, ThrowScope& throwScope) |
| 201 | { |
| 202 | UNUSED_PARAM(throwScope); |
| 203 | UNUSED_PARAM(state); |
| 204 | auto& impl = thisObject.wrapped(); |
| 205 | JSValue result = toJS<IDLInterface<SVGAnimatedLengthList>>(state, *thisObject.globalObject(), throwScope, impl.dxAnimated()); |
| 206 | return result; |
| 207 | } |
| 208 | |
| 209 | EncodedJSValue jsSVGTextPositioningElementDx(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 210 | { |
| 211 | return IDLAttribute<JSSVGTextPositioningElement>::get<jsSVGTextPositioningElementDxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "dx" ); |
| 212 | } |
| 213 | |
| 214 | static inline JSValue jsSVGTextPositioningElementDyGetter(ExecState& state, JSSVGTextPositioningElement& thisObject, ThrowScope& throwScope) |
| 215 | { |
| 216 | UNUSED_PARAM(throwScope); |
| 217 | UNUSED_PARAM(state); |
| 218 | auto& impl = thisObject.wrapped(); |
| 219 | JSValue result = toJS<IDLInterface<SVGAnimatedLengthList>>(state, *thisObject.globalObject(), throwScope, impl.dyAnimated()); |
| 220 | return result; |
| 221 | } |
| 222 | |
| 223 | EncodedJSValue jsSVGTextPositioningElementDy(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 224 | { |
| 225 | return IDLAttribute<JSSVGTextPositioningElement>::get<jsSVGTextPositioningElementDyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "dy" ); |
| 226 | } |
| 227 | |
| 228 | static inline JSValue jsSVGTextPositioningElementRotateGetter(ExecState& state, JSSVGTextPositioningElement& thisObject, ThrowScope& throwScope) |
| 229 | { |
| 230 | UNUSED_PARAM(throwScope); |
| 231 | UNUSED_PARAM(state); |
| 232 | auto& impl = thisObject.wrapped(); |
| 233 | JSValue result = toJS<IDLInterface<SVGAnimatedNumberList>>(state, *thisObject.globalObject(), throwScope, impl.rotateAnimated()); |
| 234 | return result; |
| 235 | } |
| 236 | |
| 237 | EncodedJSValue jsSVGTextPositioningElementRotate(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 238 | { |
| 239 | return IDLAttribute<JSSVGTextPositioningElement>::get<jsSVGTextPositioningElementRotateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rotate" ); |
| 240 | } |
| 241 | |
| 242 | void JSSVGTextPositioningElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 243 | { |
| 244 | auto* thisObject = jsCast<JSSVGTextPositioningElement*>(cell); |
| 245 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 246 | if (thisObject->scriptExecutionContext()) |
| 247 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 248 | Base::heapSnapshot(cell, builder); |
| 249 | } |
| 250 | |
| 251 | |
| 252 | } |
| 253 | |