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 "JSCSSKeyframeRule.h" |
23 | |
24 | #include "JSCSSStyleDeclaration.h" |
25 | #include "JSDOMAttribute.h" |
26 | #include "JSDOMBinding.h" |
27 | #include "JSDOMConstructorNotConstructable.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertStrings.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMGlobalObject.h" |
32 | #include "JSDOMWrapperCache.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 jsCSSKeyframeRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | bool setJSCSSKeyframeRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
48 | JSC::EncodedJSValue jsCSSKeyframeRuleKeyText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSCSSKeyframeRuleKeyText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsCSSKeyframeRuleStyle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | bool setJSCSSKeyframeRuleStyle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
52 | |
53 | class JSCSSKeyframeRulePrototype : public JSC::JSNonFinalObject { |
54 | public: |
55 | using Base = JSC::JSNonFinalObject; |
56 | static JSCSSKeyframeRulePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
57 | { |
58 | JSCSSKeyframeRulePrototype* ptr = new (NotNull, JSC::allocateCell<JSCSSKeyframeRulePrototype>(vm.heap)) JSCSSKeyframeRulePrototype(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 | JSCSSKeyframeRulePrototype(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 JSCSSKeyframeRuleConstructor = JSDOMConstructorNotConstructable<JSCSSKeyframeRule>; |
79 | |
80 | template<> JSValue JSCSSKeyframeRuleConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
81 | { |
82 | return JSCSSRule::getConstructor(vm, &globalObject); |
83 | } |
84 | |
85 | template<> void JSCSSKeyframeRuleConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
86 | { |
87 | putDirect(vm, vm.propertyNames->prototype, JSCSSKeyframeRule::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
88 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("CSSKeyframeRule"_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 JSCSSKeyframeRuleConstructor::s_info = { "CSSKeyframeRule" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSKeyframeRuleConstructor) }; |
93 | |
94 | /* Hash table for prototype */ |
95 | |
96 | static const HashTableValue JSCSSKeyframeRulePrototypeTableValues[] = |
97 | { |
98 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSKeyframeRuleConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSKeyframeRuleConstructor) } }, |
99 | { "keyText" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSKeyframeRuleKeyText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSKeyframeRuleKeyText) } }, |
100 | { "style" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSKeyframeRuleStyle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSKeyframeRuleStyle) } }, |
101 | }; |
102 | |
103 | const ClassInfo JSCSSKeyframeRulePrototype::s_info = { "CSSKeyframeRulePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSKeyframeRulePrototype) }; |
104 | |
105 | void JSCSSKeyframeRulePrototype::finishCreation(VM& vm) |
106 | { |
107 | Base::finishCreation(vm); |
108 | reifyStaticProperties(vm, JSCSSKeyframeRule::info(), JSCSSKeyframeRulePrototypeTableValues, *this); |
109 | } |
110 | |
111 | const ClassInfo JSCSSKeyframeRule::s_info = { "CSSKeyframeRule" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSKeyframeRule) }; |
112 | |
113 | JSCSSKeyframeRule::JSCSSKeyframeRule(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CSSKeyframeRule>&& impl) |
114 | : JSCSSRule(structure, globalObject, WTFMove(impl)) |
115 | { |
116 | } |
117 | |
118 | void JSCSSKeyframeRule::finishCreation(VM& vm) |
119 | { |
120 | Base::finishCreation(vm); |
121 | ASSERT(inherits(vm, info())); |
122 | |
123 | } |
124 | |
125 | JSObject* JSCSSKeyframeRule::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
126 | { |
127 | return JSCSSKeyframeRulePrototype::create(vm, &globalObject, JSCSSKeyframeRulePrototype::createStructure(vm, &globalObject, JSCSSRule::prototype(vm, globalObject))); |
128 | } |
129 | |
130 | JSObject* JSCSSKeyframeRule::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
131 | { |
132 | return getDOMPrototype<JSCSSKeyframeRule>(vm, globalObject); |
133 | } |
134 | |
135 | JSValue JSCSSKeyframeRule::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
136 | { |
137 | return getDOMConstructor<JSCSSKeyframeRuleConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
138 | } |
139 | |
140 | template<> inline JSCSSKeyframeRule* IDLAttribute<JSCSSKeyframeRule>::cast(ExecState& state, EncodedJSValue thisValue) |
141 | { |
142 | return jsDynamicCast<JSCSSKeyframeRule*>(state.vm(), JSValue::decode(thisValue)); |
143 | } |
144 | |
145 | EncodedJSValue jsCSSKeyframeRuleConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
146 | { |
147 | VM& vm = state->vm(); |
148 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
149 | auto* prototype = jsDynamicCast<JSCSSKeyframeRulePrototype*>(vm, JSValue::decode(thisValue)); |
150 | if (UNLIKELY(!prototype)) |
151 | return throwVMTypeError(state, throwScope); |
152 | return JSValue::encode(JSCSSKeyframeRule::getConstructor(state->vm(), prototype->globalObject())); |
153 | } |
154 | |
155 | bool setJSCSSKeyframeRuleConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
156 | { |
157 | VM& vm = state->vm(); |
158 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
159 | auto* prototype = jsDynamicCast<JSCSSKeyframeRulePrototype*>(vm, JSValue::decode(thisValue)); |
160 | if (UNLIKELY(!prototype)) { |
161 | throwVMTypeError(state, throwScope); |
162 | return false; |
163 | } |
164 | // Shadowing a built-in constructor |
165 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
166 | } |
167 | |
168 | static inline JSValue jsCSSKeyframeRuleKeyTextGetter(ExecState& state, JSCSSKeyframeRule& thisObject, ThrowScope& throwScope) |
169 | { |
170 | UNUSED_PARAM(throwScope); |
171 | UNUSED_PARAM(state); |
172 | auto& impl = thisObject.wrapped(); |
173 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.keyText()); |
174 | return result; |
175 | } |
176 | |
177 | EncodedJSValue jsCSSKeyframeRuleKeyText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
178 | { |
179 | return IDLAttribute<JSCSSKeyframeRule>::get<jsCSSKeyframeRuleKeyTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "keyText" ); |
180 | } |
181 | |
182 | static inline bool setJSCSSKeyframeRuleKeyTextSetter(ExecState& state, JSCSSKeyframeRule& thisObject, JSValue value, ThrowScope& throwScope) |
183 | { |
184 | UNUSED_PARAM(throwScope); |
185 | auto& impl = thisObject.wrapped(); |
186 | auto nativeValue = convert<IDLDOMString>(state, value); |
187 | RETURN_IF_EXCEPTION(throwScope, false); |
188 | AttributeSetter::call(state, throwScope, [&] { |
189 | return impl.setKeyText(WTFMove(nativeValue)); |
190 | }); |
191 | return true; |
192 | } |
193 | |
194 | bool setJSCSSKeyframeRuleKeyText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
195 | { |
196 | return IDLAttribute<JSCSSKeyframeRule>::set<setJSCSSKeyframeRuleKeyTextSetter>(*state, thisValue, encodedValue, "keyText" ); |
197 | } |
198 | |
199 | static inline JSValue jsCSSKeyframeRuleStyleGetter(ExecState& state, JSCSSKeyframeRule& thisObject, ThrowScope& throwScope) |
200 | { |
201 | UNUSED_PARAM(throwScope); |
202 | UNUSED_PARAM(state); |
203 | auto& impl = thisObject.wrapped(); |
204 | JSValue result = toJS<IDLInterface<CSSStyleDeclaration>>(state, *thisObject.globalObject(), throwScope, impl.style()); |
205 | return result; |
206 | } |
207 | |
208 | EncodedJSValue jsCSSKeyframeRuleStyle(ExecState* state, EncodedJSValue thisValue, PropertyName) |
209 | { |
210 | return IDLAttribute<JSCSSKeyframeRule>::get<jsCSSKeyframeRuleStyleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "style" ); |
211 | } |
212 | |
213 | static inline bool setJSCSSKeyframeRuleStyleSetter(ExecState& state, JSCSSKeyframeRule& thisObject, JSValue value, ThrowScope& throwScope) |
214 | { |
215 | UNUSED_PARAM(throwScope); |
216 | auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("style" ), strlen("style" )); |
217 | auto valueToForwardTo = thisObject.get(&state, id); |
218 | RETURN_IF_EXCEPTION(throwScope, false); |
219 | if (UNLIKELY(!valueToForwardTo.isObject())) { |
220 | throwTypeError(&state, throwScope); |
221 | return false; |
222 | } |
223 | auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("cssText" ), strlen("cssText" )); |
224 | PutPropertySlot slot(valueToForwardTo, false); |
225 | asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot); |
226 | RETURN_IF_EXCEPTION(throwScope, false); |
227 | return true; |
228 | } |
229 | |
230 | bool setJSCSSKeyframeRuleStyle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
231 | { |
232 | return IDLAttribute<JSCSSKeyframeRule>::set<setJSCSSKeyframeRuleStyleSetter>(*state, thisValue, encodedValue, "style" ); |
233 | } |
234 | |
235 | void JSCSSKeyframeRule::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
236 | { |
237 | auto* thisObject = jsCast<JSCSSKeyframeRule*>(cell); |
238 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
239 | if (thisObject->scriptExecutionContext()) |
240 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
241 | Base::heapSnapshot(cell, builder); |
242 | } |
243 | |
244 | |
245 | } |
246 | |