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 "JSCSSTransition.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertStrings.h" |
28 | #include "JSDOMExceptionHandling.h" |
29 | #include "JSDOMWrapperCache.h" |
30 | #include "ScriptExecutionContext.h" |
31 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
32 | #include <JavaScriptCore/JSCInlines.h> |
33 | #include <wtf/GetPtr.h> |
34 | #include <wtf/PointerPreparations.h> |
35 | #include <wtf/URL.h> |
36 | |
37 | |
38 | namespace WebCore { |
39 | using namespace JSC; |
40 | |
41 | // Attributes |
42 | |
43 | JSC::EncodedJSValue jsCSSTransitionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
44 | bool setJSCSSTransitionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
45 | JSC::EncodedJSValue jsCSSTransitionTransitionProperty(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | |
47 | class JSCSSTransitionPrototype : public JSC::JSNonFinalObject { |
48 | public: |
49 | using Base = JSC::JSNonFinalObject; |
50 | static JSCSSTransitionPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
51 | { |
52 | JSCSSTransitionPrototype* ptr = new (NotNull, JSC::allocateCell<JSCSSTransitionPrototype>(vm.heap)) JSCSSTransitionPrototype(vm, globalObject, structure); |
53 | ptr->finishCreation(vm); |
54 | return ptr; |
55 | } |
56 | |
57 | DECLARE_INFO; |
58 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
59 | { |
60 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
61 | } |
62 | |
63 | private: |
64 | JSCSSTransitionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
65 | : JSC::JSNonFinalObject(vm, structure) |
66 | { |
67 | } |
68 | |
69 | void finishCreation(JSC::VM&); |
70 | }; |
71 | |
72 | using JSCSSTransitionConstructor = JSDOMConstructorNotConstructable<JSCSSTransition>; |
73 | |
74 | template<> JSValue JSCSSTransitionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
75 | { |
76 | return JSWebAnimation::getConstructor(vm, &globalObject); |
77 | } |
78 | |
79 | template<> void JSCSSTransitionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
80 | { |
81 | putDirect(vm, vm.propertyNames->prototype, JSCSSTransition::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
82 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("CSSTransition"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
83 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
84 | } |
85 | |
86 | template<> const ClassInfo JSCSSTransitionConstructor::s_info = { "CSSTransition" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSTransitionConstructor) }; |
87 | |
88 | /* Hash table for prototype */ |
89 | |
90 | static const HashTableValue JSCSSTransitionPrototypeTableValues[] = |
91 | { |
92 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSTransitionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSTransitionConstructor) } }, |
93 | { "transitionProperty" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSTransitionTransitionProperty), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
94 | }; |
95 | |
96 | const ClassInfo JSCSSTransitionPrototype::s_info = { "CSSTransitionPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSTransitionPrototype) }; |
97 | |
98 | void JSCSSTransitionPrototype::finishCreation(VM& vm) |
99 | { |
100 | Base::finishCreation(vm); |
101 | reifyStaticProperties(vm, JSCSSTransition::info(), JSCSSTransitionPrototypeTableValues, *this); |
102 | } |
103 | |
104 | const ClassInfo JSCSSTransition::s_info = { "CSSTransition" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSTransition) }; |
105 | |
106 | JSCSSTransition::JSCSSTransition(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CSSTransition>&& impl) |
107 | : JSWebAnimation(structure, globalObject, WTFMove(impl)) |
108 | { |
109 | } |
110 | |
111 | void JSCSSTransition::finishCreation(VM& vm) |
112 | { |
113 | Base::finishCreation(vm); |
114 | ASSERT(inherits(vm, info())); |
115 | |
116 | } |
117 | |
118 | JSObject* JSCSSTransition::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
119 | { |
120 | return JSCSSTransitionPrototype::create(vm, &globalObject, JSCSSTransitionPrototype::createStructure(vm, &globalObject, JSWebAnimation::prototype(vm, globalObject))); |
121 | } |
122 | |
123 | JSObject* JSCSSTransition::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
124 | { |
125 | return getDOMPrototype<JSCSSTransition>(vm, globalObject); |
126 | } |
127 | |
128 | JSValue JSCSSTransition::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
129 | { |
130 | return getDOMConstructor<JSCSSTransitionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
131 | } |
132 | |
133 | template<> inline JSCSSTransition* IDLAttribute<JSCSSTransition>::cast(ExecState& state, EncodedJSValue thisValue) |
134 | { |
135 | return jsDynamicCast<JSCSSTransition*>(state.vm(), JSValue::decode(thisValue)); |
136 | } |
137 | |
138 | EncodedJSValue jsCSSTransitionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
139 | { |
140 | VM& vm = state->vm(); |
141 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
142 | auto* prototype = jsDynamicCast<JSCSSTransitionPrototype*>(vm, JSValue::decode(thisValue)); |
143 | if (UNLIKELY(!prototype)) |
144 | return throwVMTypeError(state, throwScope); |
145 | return JSValue::encode(JSCSSTransition::getConstructor(state->vm(), prototype->globalObject())); |
146 | } |
147 | |
148 | bool setJSCSSTransitionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
149 | { |
150 | VM& vm = state->vm(); |
151 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
152 | auto* prototype = jsDynamicCast<JSCSSTransitionPrototype*>(vm, JSValue::decode(thisValue)); |
153 | if (UNLIKELY(!prototype)) { |
154 | throwVMTypeError(state, throwScope); |
155 | return false; |
156 | } |
157 | // Shadowing a built-in constructor |
158 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
159 | } |
160 | |
161 | static inline JSValue jsCSSTransitionTransitionPropertyGetter(ExecState& state, JSCSSTransition& thisObject, ThrowScope& throwScope) |
162 | { |
163 | UNUSED_PARAM(throwScope); |
164 | UNUSED_PARAM(state); |
165 | auto& impl = thisObject.wrapped(); |
166 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.transitionProperty()); |
167 | return result; |
168 | } |
169 | |
170 | EncodedJSValue jsCSSTransitionTransitionProperty(ExecState* state, EncodedJSValue thisValue, PropertyName) |
171 | { |
172 | return IDLAttribute<JSCSSTransition>::get<jsCSSTransitionTransitionPropertyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "transitionProperty" ); |
173 | } |
174 | |
175 | void JSCSSTransition::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
176 | { |
177 | auto* thisObject = jsCast<JSCSSTransition*>(cell); |
178 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
179 | if (thisObject->scriptExecutionContext()) |
180 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
181 | Base::heapSnapshot(cell, builder); |
182 | } |
183 | |
184 | bool JSCSSTransitionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
185 | { |
186 | auto* jsCSSTransition = jsCast<JSCSSTransition*>(handle.slot()->asCell()); |
187 | if (jsCSSTransition->wrapped().hasPendingActivity()) { |
188 | if (UNLIKELY(reason)) |
189 | *reason = "ActiveDOMObject with pending activity" ; |
190 | return true; |
191 | } |
192 | if (jsCSSTransition->wrapped().isFiringEventListeners()) { |
193 | if (UNLIKELY(reason)) |
194 | *reason = "EventTarget firing event listeners" ; |
195 | return true; |
196 | } |
197 | UNUSED_PARAM(visitor); |
198 | UNUSED_PARAM(reason); |
199 | return false; |
200 | } |
201 | |
202 | void JSCSSTransitionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
203 | { |
204 | auto* jsCSSTransition = static_cast<JSCSSTransition*>(handle.slot()->asCell()); |
205 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
206 | uncacheWrapper(world, &jsCSSTransition->wrapped(), jsCSSTransition); |
207 | } |
208 | |
209 | |
210 | } |
211 | |