OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ElementAnimation_h | 31 #ifndef ElementAnimation_h |
32 #define ElementAnimation_h | 32 #define ElementAnimation_h |
33 | 33 |
34 #include "bindings/core/v8/DictionarySequenceOrDictionary.h" | 34 #include "bindings/core/v8/DictionarySequenceOrDictionary.h" |
35 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h" | 35 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeAnimationOptions.h" |
36 #include "core/animation/DocumentTimeline.h" | 36 #include "core/animation/DocumentTimeline.h" |
37 #include "core/animation/EffectInput.h" | 37 #include "core/animation/EffectInput.h" |
38 #include "core/animation/ElementAnimations.h" | 38 #include "core/animation/ElementAnimations.h" |
39 #include "core/animation/KeyframeEffect.h" | 39 #include "core/animation/KeyframeEffect.h" |
40 #include "core/animation/KeyframeEffectReadOnly.h" | 40 #include "core/animation/KeyframeEffectReadOnly.h" |
41 #include "core/animation/TimingInput.h" | 41 #include "core/animation/TimingInput.h" |
42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
43 #include "core/dom/Element.h" | 43 #include "core/dom/Element.h" |
44 #include "core/dom/ExecutionContext.h" | 44 #include "core/dom/ExecutionContext.h" |
45 #include "platform/RuntimeEnabledFeatures.h" | 45 #include "platform/RuntimeEnabledFeatures.h" |
46 #include "platform/bindings/ScriptState.h" | 46 #include "platform/bindings/ScriptState.h" |
47 #include "platform/wtf/Allocator.h" | 47 #include "platform/wtf/Allocator.h" |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 class ElementAnimation { | 51 class ElementAnimation { |
52 STATIC_ONLY(ElementAnimation); | 52 STATIC_ONLY(ElementAnimation); |
53 | 53 |
54 public: | 54 public: |
55 static Animation* animate(ScriptState* script_state, | 55 static Animation* animate( |
56 Element& element, | 56 ScriptState* script_state, |
57 const DictionarySequenceOrDictionary& effect_input, | 57 Element& element, |
58 UnrestrictedDoubleOrKeyframeEffectOptions options, | 58 const DictionarySequenceOrDictionary& effect_input, |
59 ExceptionState& exception_state) { | 59 UnrestrictedDoubleOrKeyframeAnimationOptions options, |
| 60 ExceptionState& exception_state) { |
60 EffectModel* effect = EffectInput::Convert( | 61 EffectModel* effect = EffectInput::Convert( |
61 &element, effect_input, ExecutionContext::From(script_state), | 62 &element, effect_input, ExecutionContext::From(script_state), |
62 exception_state); | 63 exception_state); |
63 if (exception_state.HadException()) | 64 if (exception_state.HadException()) |
64 return nullptr; | 65 return nullptr; |
65 | 66 |
66 Timing timing; | 67 Timing timing; |
67 if (!TimingInput::Convert(options, timing, &element.GetDocument(), | 68 if (!TimingInput::Convert(options, timing, &element.GetDocument(), |
68 exception_state)) | 69 exception_state)) |
69 return nullptr; | 70 return nullptr; |
70 | 71 |
71 if (options.isKeyframeEffectOptions()) { | 72 if (options.isKeyframeAnimationOptions()) { |
72 Animation* animation = animate(element, effect, timing); | 73 Animation* animation = animate(element, effect, timing); |
73 animation->setId(options.getAsKeyframeEffectOptions().id()); | 74 animation->setId(options.getAsKeyframeAnimationOptions().id()); |
74 return animation; | 75 return animation; |
75 } | 76 } |
76 return animate(element, effect, timing); | 77 return animate(element, effect, timing); |
77 } | 78 } |
78 | 79 |
79 static Animation* animate(ScriptState* script_state, | 80 static Animation* animate(ScriptState* script_state, |
80 Element& element, | 81 Element& element, |
81 const DictionarySequenceOrDictionary& effect_input, | 82 const DictionarySequenceOrDictionary& effect_input, |
82 ExceptionState& exception_state) { | 83 ExceptionState& exception_state) { |
83 EffectModel* effect = EffectInput::Convert( | 84 EffectModel* effect = EffectInput::Convert( |
(...skipping 26 matching lines...) Expand all Loading... |
110 animation->effect()->IsInEffect())) | 111 animation->effect()->IsInEffect())) |
111 animations.push_back(animation); | 112 animations.push_back(animation); |
112 } | 113 } |
113 return animations; | 114 return animations; |
114 } | 115 } |
115 }; | 116 }; |
116 | 117 |
117 } // namespace blink | 118 } // namespace blink |
118 | 119 |
119 #endif // ElementAnimation_h | 120 #endif // ElementAnimation_h |
OLD | NEW |