| 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 "JSSVGLineElement.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 "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 jsSVGLineElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 47 | bool setJSSVGLineElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 48 | JSC::EncodedJSValue jsSVGLineElementX1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 49 | JSC::EncodedJSValue jsSVGLineElementY1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 50 | JSC::EncodedJSValue jsSVGLineElementX2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsSVGLineElementY2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | JSC::EncodedJSValue jsSVGLineElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 53 | |
| 54 | class JSSVGLineElementPrototype : public JSC::JSNonFinalObject { |
| 55 | public: |
| 56 | using Base = JSC::JSNonFinalObject; |
| 57 | static JSSVGLineElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 58 | { |
| 59 | JSSVGLineElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGLineElementPrototype>(vm.heap)) JSSVGLineElementPrototype(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 | JSSVGLineElementPrototype(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 JSSVGLineElementConstructor = JSDOMConstructorNotConstructable<JSSVGLineElement>; |
| 80 | |
| 81 | template<> JSValue JSSVGLineElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 82 | { |
| 83 | return JSSVGGeometryElement::getConstructor(vm, &globalObject); |
| 84 | } |
| 85 | |
| 86 | template<> void JSSVGLineElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 87 | { |
| 88 | putDirect(vm, vm.propertyNames->prototype, JSSVGLineElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 89 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGLineElement"_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 JSSVGLineElementConstructor::s_info = { "SVGLineElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLineElementConstructor) }; |
| 94 | |
| 95 | /* Hash table for prototype */ |
| 96 | |
| 97 | static const HashTableValue JSSVGLineElementPrototypeTableValues[] = |
| 98 | { |
| 99 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGLineElementConstructor) } }, |
| 100 | { "x1" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementX1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 101 | { "y1" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementY1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 102 | { "x2" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementX2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 103 | { "y2" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementY2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 104 | { "externalResourcesRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLineElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 105 | }; |
| 106 | |
| 107 | const ClassInfo JSSVGLineElementPrototype::s_info = { "SVGLineElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLineElementPrototype) }; |
| 108 | |
| 109 | void JSSVGLineElementPrototype::finishCreation(VM& vm) |
| 110 | { |
| 111 | Base::finishCreation(vm); |
| 112 | reifyStaticProperties(vm, JSSVGLineElement::info(), JSSVGLineElementPrototypeTableValues, *this); |
| 113 | } |
| 114 | |
| 115 | const ClassInfo JSSVGLineElement::s_info = { "SVGLineElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLineElement) }; |
| 116 | |
| 117 | JSSVGLineElement::JSSVGLineElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGLineElement>&& impl) |
| 118 | : JSSVGGeometryElement(structure, globalObject, WTFMove(impl)) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | void JSSVGLineElement::finishCreation(VM& vm) |
| 123 | { |
| 124 | Base::finishCreation(vm); |
| 125 | ASSERT(inherits(vm, info())); |
| 126 | |
| 127 | } |
| 128 | |
| 129 | JSObject* JSSVGLineElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 130 | { |
| 131 | return JSSVGLineElementPrototype::create(vm, &globalObject, JSSVGLineElementPrototype::createStructure(vm, &globalObject, JSSVGGeometryElement::prototype(vm, globalObject))); |
| 132 | } |
| 133 | |
| 134 | JSObject* JSSVGLineElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 135 | { |
| 136 | return getDOMPrototype<JSSVGLineElement>(vm, globalObject); |
| 137 | } |
| 138 | |
| 139 | JSValue JSSVGLineElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 140 | { |
| 141 | return getDOMConstructor<JSSVGLineElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 142 | } |
| 143 | |
| 144 | template<> inline JSSVGLineElement* IDLAttribute<JSSVGLineElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 145 | { |
| 146 | return jsDynamicCast<JSSVGLineElement*>(state.vm(), JSValue::decode(thisValue)); |
| 147 | } |
| 148 | |
| 149 | EncodedJSValue jsSVGLineElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 150 | { |
| 151 | VM& vm = state->vm(); |
| 152 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 153 | auto* prototype = jsDynamicCast<JSSVGLineElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 154 | if (UNLIKELY(!prototype)) |
| 155 | return throwVMTypeError(state, throwScope); |
| 156 | return JSValue::encode(JSSVGLineElement::getConstructor(state->vm(), prototype->globalObject())); |
| 157 | } |
| 158 | |
| 159 | bool setJSSVGLineElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 160 | { |
| 161 | VM& vm = state->vm(); |
| 162 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 163 | auto* prototype = jsDynamicCast<JSSVGLineElementPrototype*>(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 jsSVGLineElementX1Getter(ExecState& state, JSSVGLineElement& thisObject, ThrowScope& throwScope) |
| 173 | { |
| 174 | UNUSED_PARAM(throwScope); |
| 175 | UNUSED_PARAM(state); |
| 176 | auto& impl = thisObject.wrapped(); |
| 177 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.x1Animated()); |
| 178 | return result; |
| 179 | } |
| 180 | |
| 181 | EncodedJSValue jsSVGLineElementX1(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 182 | { |
| 183 | return IDLAttribute<JSSVGLineElement>::get<jsSVGLineElementX1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x1" ); |
| 184 | } |
| 185 | |
| 186 | static inline JSValue jsSVGLineElementY1Getter(ExecState& state, JSSVGLineElement& thisObject, ThrowScope& throwScope) |
| 187 | { |
| 188 | UNUSED_PARAM(throwScope); |
| 189 | UNUSED_PARAM(state); |
| 190 | auto& impl = thisObject.wrapped(); |
| 191 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y1Animated()); |
| 192 | return result; |
| 193 | } |
| 194 | |
| 195 | EncodedJSValue jsSVGLineElementY1(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 196 | { |
| 197 | return IDLAttribute<JSSVGLineElement>::get<jsSVGLineElementY1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y1" ); |
| 198 | } |
| 199 | |
| 200 | static inline JSValue jsSVGLineElementX2Getter(ExecState& state, JSSVGLineElement& thisObject, ThrowScope& throwScope) |
| 201 | { |
| 202 | UNUSED_PARAM(throwScope); |
| 203 | UNUSED_PARAM(state); |
| 204 | auto& impl = thisObject.wrapped(); |
| 205 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.x2Animated()); |
| 206 | return result; |
| 207 | } |
| 208 | |
| 209 | EncodedJSValue jsSVGLineElementX2(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 210 | { |
| 211 | return IDLAttribute<JSSVGLineElement>::get<jsSVGLineElementX2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x2" ); |
| 212 | } |
| 213 | |
| 214 | static inline JSValue jsSVGLineElementY2Getter(ExecState& state, JSSVGLineElement& thisObject, ThrowScope& throwScope) |
| 215 | { |
| 216 | UNUSED_PARAM(throwScope); |
| 217 | UNUSED_PARAM(state); |
| 218 | auto& impl = thisObject.wrapped(); |
| 219 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y2Animated()); |
| 220 | return result; |
| 221 | } |
| 222 | |
| 223 | EncodedJSValue jsSVGLineElementY2(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 224 | { |
| 225 | return IDLAttribute<JSSVGLineElement>::get<jsSVGLineElementY2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y2" ); |
| 226 | } |
| 227 | |
| 228 | static inline JSValue jsSVGLineElementExternalResourcesRequiredGetter(ExecState& state, JSSVGLineElement& thisObject, ThrowScope& throwScope) |
| 229 | { |
| 230 | UNUSED_PARAM(throwScope); |
| 231 | UNUSED_PARAM(state); |
| 232 | auto& impl = thisObject.wrapped(); |
| 233 | JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated()); |
| 234 | return result; |
| 235 | } |
| 236 | |
| 237 | EncodedJSValue jsSVGLineElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 238 | { |
| 239 | return IDLAttribute<JSSVGLineElement>::get<jsSVGLineElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
| 240 | } |
| 241 | |
| 242 | void JSSVGLineElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 243 | { |
| 244 | auto* thisObject = jsCast<JSSVGLineElement*>(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 | |