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 "JSOptionalEffectTiming.h"
23
24#include "JSDOMConvertEnumeration.h"
25#include "JSDOMConvertNumbers.h"
26#include "JSDOMConvertStrings.h"
27#include "JSDOMConvertUnion.h"
28#include "JSFillMode.h"
29#include "JSPlaybackDirection.h"
30#include <JavaScriptCore/JSCInlines.h>
31#include <wtf/Variant.h>
32
33
34namespace WebCore {
35using namespace JSC;
36
37template<> OptionalEffectTiming convertDictionary<OptionalEffectTiming>(ExecState& state, JSValue value)
38{
39 VM& vm = state.vm();
40 auto throwScope = DECLARE_THROW_SCOPE(vm);
41 bool isNullOrUndefined = value.isUndefinedOrNull();
42 auto* object = isNullOrUndefined ? nullptr : value.getObject();
43 if (UNLIKELY(!isNullOrUndefined && !object)) {
44 throwTypeError(&state, throwScope);
45 return { };
46 }
47 OptionalEffectTiming result;
48 JSValue delayValue;
49 if (isNullOrUndefined)
50 delayValue = jsUndefined();
51 else {
52 delayValue = object->get(&state, Identifier::fromString(&state, "delay"));
53 RETURN_IF_EXCEPTION(throwScope, { });
54 }
55 if (!delayValue.isUndefined()) {
56 result.delay = convert<IDLDouble>(state, delayValue);
57 RETURN_IF_EXCEPTION(throwScope, { });
58 }
59 JSValue directionValue;
60 if (isNullOrUndefined)
61 directionValue = jsUndefined();
62 else {
63 directionValue = object->get(&state, Identifier::fromString(&state, "direction"));
64 RETURN_IF_EXCEPTION(throwScope, { });
65 }
66 if (!directionValue.isUndefined()) {
67 result.direction = convert<IDLEnumeration<PlaybackDirection>>(state, directionValue);
68 RETURN_IF_EXCEPTION(throwScope, { });
69 }
70 JSValue durationValue;
71 if (isNullOrUndefined)
72 durationValue = jsUndefined();
73 else {
74 durationValue = object->get(&state, Identifier::fromString(&state, "duration"));
75 RETURN_IF_EXCEPTION(throwScope, { });
76 }
77 if (!durationValue.isUndefined()) {
78 result.duration = convert<IDLUnion<IDLUnrestrictedDouble, IDLDOMString>>(state, durationValue);
79 RETURN_IF_EXCEPTION(throwScope, { });
80 }
81 JSValue easingValue;
82 if (isNullOrUndefined)
83 easingValue = jsUndefined();
84 else {
85 easingValue = object->get(&state, Identifier::fromString(&state, "easing"));
86 RETURN_IF_EXCEPTION(throwScope, { });
87 }
88 if (!easingValue.isUndefined()) {
89 result.easing = convert<IDLDOMString>(state, easingValue);
90 RETURN_IF_EXCEPTION(throwScope, { });
91 }
92 JSValue endDelayValue;
93 if (isNullOrUndefined)
94 endDelayValue = jsUndefined();
95 else {
96 endDelayValue = object->get(&state, Identifier::fromString(&state, "endDelay"));
97 RETURN_IF_EXCEPTION(throwScope, { });
98 }
99 if (!endDelayValue.isUndefined()) {
100 result.endDelay = convert<IDLDouble>(state, endDelayValue);
101 RETURN_IF_EXCEPTION(throwScope, { });
102 }
103 JSValue fillValue;
104 if (isNullOrUndefined)
105 fillValue = jsUndefined();
106 else {
107 fillValue = object->get(&state, Identifier::fromString(&state, "fill"));
108 RETURN_IF_EXCEPTION(throwScope, { });
109 }
110 if (!fillValue.isUndefined()) {
111 result.fill = convert<IDLEnumeration<FillMode>>(state, fillValue);
112 RETURN_IF_EXCEPTION(throwScope, { });
113 }
114 JSValue iterationStartValue;
115 if (isNullOrUndefined)
116 iterationStartValue = jsUndefined();
117 else {
118 iterationStartValue = object->get(&state, Identifier::fromString(&state, "iterationStart"));
119 RETURN_IF_EXCEPTION(throwScope, { });
120 }
121 if (!iterationStartValue.isUndefined()) {
122 result.iterationStart = convert<IDLDouble>(state, iterationStartValue);
123 RETURN_IF_EXCEPTION(throwScope, { });
124 }
125 JSValue iterationsValue;
126 if (isNullOrUndefined)
127 iterationsValue = jsUndefined();
128 else {
129 iterationsValue = object->get(&state, Identifier::fromString(&state, "iterations"));
130 RETURN_IF_EXCEPTION(throwScope, { });
131 }
132 if (!iterationsValue.isUndefined()) {
133 result.iterations = convert<IDLUnrestrictedDouble>(state, iterationsValue);
134 RETURN_IF_EXCEPTION(throwScope, { });
135 }
136 return result;
137}
138
139} // namespace WebCore
140