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 "JSKeyframeAnimationOptions.h" |
23 | |
24 | #include "JSCompositeOperation.h" |
25 | #include "JSDOMConvertEnumeration.h" |
26 | #include "JSDOMConvertNumbers.h" |
27 | #include "JSDOMConvertStrings.h" |
28 | #include "JSDOMConvertUnion.h" |
29 | #include "JSFillMode.h" |
30 | #include "JSIterationCompositeOperation.h" |
31 | #include "JSPlaybackDirection.h" |
32 | #include <JavaScriptCore/JSCInlines.h> |
33 | #include <wtf/Variant.h> |
34 | |
35 | |
36 | namespace WebCore { |
37 | using namespace JSC; |
38 | |
39 | template<> KeyframeAnimationOptions convertDictionary<KeyframeAnimationOptions>(ExecState& state, JSValue value) |
40 | { |
41 | VM& vm = state.vm(); |
42 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
43 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
44 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
45 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
46 | throwTypeError(&state, throwScope); |
47 | return { }; |
48 | } |
49 | KeyframeAnimationOptions result; |
50 | JSValue delayValue; |
51 | if (isNullOrUndefined) |
52 | delayValue = jsUndefined(); |
53 | else { |
54 | delayValue = object->get(&state, Identifier::fromString(&state, "delay" )); |
55 | RETURN_IF_EXCEPTION(throwScope, { }); |
56 | } |
57 | if (!delayValue.isUndefined()) { |
58 | result.delay = convert<IDLDouble>(state, delayValue); |
59 | RETURN_IF_EXCEPTION(throwScope, { }); |
60 | } else |
61 | result.delay = 0; |
62 | JSValue directionValue; |
63 | if (isNullOrUndefined) |
64 | directionValue = jsUndefined(); |
65 | else { |
66 | directionValue = object->get(&state, Identifier::fromString(&state, "direction" )); |
67 | RETURN_IF_EXCEPTION(throwScope, { }); |
68 | } |
69 | if (!directionValue.isUndefined()) { |
70 | result.direction = convert<IDLEnumeration<PlaybackDirection>>(state, directionValue); |
71 | RETURN_IF_EXCEPTION(throwScope, { }); |
72 | } else |
73 | result.direction = PlaybackDirection::Normal; |
74 | JSValue durationValue; |
75 | if (isNullOrUndefined) |
76 | durationValue = jsUndefined(); |
77 | else { |
78 | durationValue = object->get(&state, Identifier::fromString(&state, "duration" )); |
79 | RETURN_IF_EXCEPTION(throwScope, { }); |
80 | } |
81 | if (!durationValue.isUndefined()) { |
82 | result.duration = convert<IDLUnion<IDLUnrestrictedDouble, IDLDOMString>>(state, durationValue); |
83 | RETURN_IF_EXCEPTION(throwScope, { }); |
84 | } else |
85 | result.duration = "auto" ; |
86 | JSValue easingValue; |
87 | if (isNullOrUndefined) |
88 | easingValue = jsUndefined(); |
89 | else { |
90 | easingValue = object->get(&state, Identifier::fromString(&state, "easing" )); |
91 | RETURN_IF_EXCEPTION(throwScope, { }); |
92 | } |
93 | if (!easingValue.isUndefined()) { |
94 | result.easing = convert<IDLDOMString>(state, easingValue); |
95 | RETURN_IF_EXCEPTION(throwScope, { }); |
96 | } else |
97 | result.easing = "linear"_s ; |
98 | JSValue endDelayValue; |
99 | if (isNullOrUndefined) |
100 | endDelayValue = jsUndefined(); |
101 | else { |
102 | endDelayValue = object->get(&state, Identifier::fromString(&state, "endDelay" )); |
103 | RETURN_IF_EXCEPTION(throwScope, { }); |
104 | } |
105 | if (!endDelayValue.isUndefined()) { |
106 | result.endDelay = convert<IDLDouble>(state, endDelayValue); |
107 | RETURN_IF_EXCEPTION(throwScope, { }); |
108 | } else |
109 | result.endDelay = 0; |
110 | JSValue fillValue; |
111 | if (isNullOrUndefined) |
112 | fillValue = jsUndefined(); |
113 | else { |
114 | fillValue = object->get(&state, Identifier::fromString(&state, "fill" )); |
115 | RETURN_IF_EXCEPTION(throwScope, { }); |
116 | } |
117 | if (!fillValue.isUndefined()) { |
118 | result.fill = convert<IDLEnumeration<FillMode>>(state, fillValue); |
119 | RETURN_IF_EXCEPTION(throwScope, { }); |
120 | } else |
121 | result.fill = FillMode::Auto; |
122 | JSValue iterationStartValue; |
123 | if (isNullOrUndefined) |
124 | iterationStartValue = jsUndefined(); |
125 | else { |
126 | iterationStartValue = object->get(&state, Identifier::fromString(&state, "iterationStart" )); |
127 | RETURN_IF_EXCEPTION(throwScope, { }); |
128 | } |
129 | if (!iterationStartValue.isUndefined()) { |
130 | result.iterationStart = convert<IDLDouble>(state, iterationStartValue); |
131 | RETURN_IF_EXCEPTION(throwScope, { }); |
132 | } else |
133 | result.iterationStart = 0.0; |
134 | JSValue iterationsValue; |
135 | if (isNullOrUndefined) |
136 | iterationsValue = jsUndefined(); |
137 | else { |
138 | iterationsValue = object->get(&state, Identifier::fromString(&state, "iterations" )); |
139 | RETURN_IF_EXCEPTION(throwScope, { }); |
140 | } |
141 | if (!iterationsValue.isUndefined()) { |
142 | result.iterations = convert<IDLUnrestrictedDouble>(state, iterationsValue); |
143 | RETURN_IF_EXCEPTION(throwScope, { }); |
144 | } else |
145 | result.iterations = 1.0; |
146 | JSValue compositeValue; |
147 | if (isNullOrUndefined) |
148 | compositeValue = jsUndefined(); |
149 | else { |
150 | compositeValue = object->get(&state, Identifier::fromString(&state, "composite" )); |
151 | RETURN_IF_EXCEPTION(throwScope, { }); |
152 | } |
153 | if (!compositeValue.isUndefined()) { |
154 | result.composite = convert<IDLEnumeration<CompositeOperation>>(state, compositeValue); |
155 | RETURN_IF_EXCEPTION(throwScope, { }); |
156 | } else |
157 | result.composite = CompositeOperation::Replace; |
158 | JSValue iterationCompositeValue; |
159 | if (isNullOrUndefined) |
160 | iterationCompositeValue = jsUndefined(); |
161 | else { |
162 | iterationCompositeValue = object->get(&state, Identifier::fromString(&state, "iterationComposite" )); |
163 | RETURN_IF_EXCEPTION(throwScope, { }); |
164 | } |
165 | if (!iterationCompositeValue.isUndefined()) { |
166 | result.iterationComposite = convert<IDLEnumeration<IterationCompositeOperation>>(state, iterationCompositeValue); |
167 | RETURN_IF_EXCEPTION(throwScope, { }); |
168 | } else |
169 | result.iterationComposite = IterationCompositeOperation::Replace; |
170 | JSValue idValue; |
171 | if (isNullOrUndefined) |
172 | idValue = jsUndefined(); |
173 | else { |
174 | idValue = object->get(&state, Identifier::fromString(&state, "id" )); |
175 | RETURN_IF_EXCEPTION(throwScope, { }); |
176 | } |
177 | if (!idValue.isUndefined()) { |
178 | result.id = convert<IDLDOMString>(state, idValue); |
179 | RETURN_IF_EXCEPTION(throwScope, { }); |
180 | } else |
181 | result.id = emptyString(); |
182 | return result; |
183 | } |
184 | |
185 | } // namespace WebCore |
186 | |