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 "JSAnimationPlaybackEventInit.h" |
23 | |
24 | #include "JSDOMConvertBoolean.h" |
25 | #include "JSDOMConvertNullable.h" |
26 | #include "JSDOMConvertNumbers.h" |
27 | #include <JavaScriptCore/JSCInlines.h> |
28 | |
29 | |
30 | namespace WebCore { |
31 | using namespace JSC; |
32 | |
33 | template<> AnimationPlaybackEventInit convertDictionary<AnimationPlaybackEventInit>(ExecState& state, JSValue value) |
34 | { |
35 | VM& vm = state.vm(); |
36 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
37 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
38 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
39 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
40 | throwTypeError(&state, throwScope); |
41 | return { }; |
42 | } |
43 | AnimationPlaybackEventInit result; |
44 | JSValue bubblesValue; |
45 | if (isNullOrUndefined) |
46 | bubblesValue = jsUndefined(); |
47 | else { |
48 | bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles" )); |
49 | RETURN_IF_EXCEPTION(throwScope, { }); |
50 | } |
51 | if (!bubblesValue.isUndefined()) { |
52 | result.bubbles = convert<IDLBoolean>(state, bubblesValue); |
53 | RETURN_IF_EXCEPTION(throwScope, { }); |
54 | } else |
55 | result.bubbles = false; |
56 | JSValue cancelableValue; |
57 | if (isNullOrUndefined) |
58 | cancelableValue = jsUndefined(); |
59 | else { |
60 | cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable" )); |
61 | RETURN_IF_EXCEPTION(throwScope, { }); |
62 | } |
63 | if (!cancelableValue.isUndefined()) { |
64 | result.cancelable = convert<IDLBoolean>(state, cancelableValue); |
65 | RETURN_IF_EXCEPTION(throwScope, { }); |
66 | } else |
67 | result.cancelable = false; |
68 | JSValue composedValue; |
69 | if (isNullOrUndefined) |
70 | composedValue = jsUndefined(); |
71 | else { |
72 | composedValue = object->get(&state, Identifier::fromString(&state, "composed" )); |
73 | RETURN_IF_EXCEPTION(throwScope, { }); |
74 | } |
75 | if (!composedValue.isUndefined()) { |
76 | result.composed = convert<IDLBoolean>(state, composedValue); |
77 | RETURN_IF_EXCEPTION(throwScope, { }); |
78 | } else |
79 | result.composed = false; |
80 | JSValue currentTimeValue; |
81 | if (isNullOrUndefined) |
82 | currentTimeValue = jsUndefined(); |
83 | else { |
84 | currentTimeValue = object->get(&state, Identifier::fromString(&state, "currentTime" )); |
85 | RETURN_IF_EXCEPTION(throwScope, { }); |
86 | } |
87 | if (!currentTimeValue.isUndefined()) { |
88 | result.currentTime = convert<IDLNullable<IDLDouble>>(state, currentTimeValue); |
89 | RETURN_IF_EXCEPTION(throwScope, { }); |
90 | } else |
91 | result.currentTime = WTF::nullopt; |
92 | JSValue timelineTimeValue; |
93 | if (isNullOrUndefined) |
94 | timelineTimeValue = jsUndefined(); |
95 | else { |
96 | timelineTimeValue = object->get(&state, Identifier::fromString(&state, "timelineTime" )); |
97 | RETURN_IF_EXCEPTION(throwScope, { }); |
98 | } |
99 | if (!timelineTimeValue.isUndefined()) { |
100 | result.timelineTime = convert<IDLNullable<IDLDouble>>(state, timelineTimeValue); |
101 | RETURN_IF_EXCEPTION(throwScope, { }); |
102 | } else |
103 | result.timelineTime = WTF::nullopt; |
104 | return result; |
105 | } |
106 | |
107 | } // namespace WebCore |
108 | |