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