| 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 #include "core/animation/KeyframeEffect.h" | 31 #include "core/animation/KeyframeEffect.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/Dictionary.h" | 33 #include "bindings/core/v8/Dictionary.h" |
| 34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 35 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h" |
| 35 #include "core/animation/AnimationEffectTiming.h" | 36 #include "core/animation/AnimationEffectTiming.h" |
| 36 #include "core/animation/EffectInput.h" | 37 #include "core/animation/EffectInput.h" |
| 37 #include "core/animation/KeyframeEffectOptions.h" | 38 #include "core/animation/KeyframeEffectOptions.h" |
| 38 #include "core/animation/KeyframeEffectReadOnly.h" | 39 #include "core/animation/KeyframeEffectReadOnly.h" |
| 39 #include "core/animation/TimingInput.h" | 40 #include "core/animation/TimingInput.h" |
| 40 #include "core/dom/Element.h" | 41 #include "core/dom/Element.h" |
| 41 #include "core/frame/UseCounter.h" | 42 #include "core/frame/UseCounter.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 KeyframeEffect* KeyframeEffect::Create( | 46 KeyframeEffect* KeyframeEffect::Create( |
| 46 Element* target, | 47 Element* target, |
| 47 EffectModel* model, | 48 EffectModel* model, |
| 48 const Timing& timing, | 49 const Timing& timing, |
| 49 KeyframeEffectReadOnly::Priority priority, | 50 KeyframeEffectReadOnly::Priority priority, |
| 50 EventDelegate* event_delegate) { | 51 EventDelegate* event_delegate) { |
| 51 return new KeyframeEffect(target, model, timing, priority, event_delegate); | 52 return new KeyframeEffect(target, model, timing, priority, event_delegate); |
| 52 } | 53 } |
| 53 | 54 |
| 54 KeyframeEffect* KeyframeEffect::Create( | 55 KeyframeEffect* KeyframeEffect::Create( |
| 55 ExecutionContext* execution_context, | 56 ExecutionContext* execution_context, |
| 56 Element* element, | 57 Element* element, |
| 57 const DictionarySequenceOrDictionary& effect_input, | 58 const DictionarySequenceOrDictionary& effect_input, |
| 58 double duration, | 59 const UnrestrictedDoubleOrKeyframeEffectOptions& options, |
| 59 ExceptionState& exception_state) { | 60 ExceptionState& exception_state) { |
| 60 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 61 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| 61 if (element) { | 62 if (element) { |
| 62 UseCounter::Count( | |
| 63 element->GetDocument(), | |
| 64 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming); | |
| 65 } | |
| 66 Timing timing; | |
| 67 if (!TimingInput::Convert(duration, timing, exception_state)) | |
| 68 return nullptr; | |
| 69 return Create(element, | |
| 70 EffectInput::Convert(element, effect_input, execution_context, | |
| 71 exception_state), | |
| 72 timing); | |
| 73 } | |
| 74 | |
| 75 KeyframeEffect* KeyframeEffect::Create( | |
| 76 ExecutionContext* execution_context, | |
| 77 Element* element, | |
| 78 const DictionarySequenceOrDictionary& effect_input, | |
| 79 const KeyframeEffectOptions& timing_input, | |
| 80 ExceptionState& exception_state) { | |
| 81 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | |
| 82 if (element) { | |
| 83 UseCounter::Count( | 63 UseCounter::Count( |
| 84 element->GetDocument(), | 64 element->GetDocument(), |
| 85 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming); | 65 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming); |
| 86 } | 66 } |
| 87 Timing timing; | 67 Timing timing; |
| 88 Document* document = element ? &element->GetDocument() : nullptr; | 68 Document* document = element ? &element->GetDocument() : nullptr; |
| 89 if (!TimingInput::Convert(timing_input, timing, document, exception_state)) | 69 if (!TimingInput::Convert(options, timing, document, exception_state)) |
| 90 return nullptr; | 70 return nullptr; |
| 91 return Create(element, | 71 return Create(element, |
| 92 EffectInput::Convert(element, effect_input, execution_context, | 72 EffectInput::Convert(element, effect_input, execution_context, |
| 93 exception_state), | 73 exception_state), |
| 94 timing); | 74 timing); |
| 95 } | 75 } |
| 96 | 76 |
| 97 KeyframeEffect* KeyframeEffect::Create( | 77 KeyframeEffect* KeyframeEffect::Create( |
| 98 ExecutionContext* execution_context, | 78 ExecutionContext* execution_context, |
| 99 Element* element, | 79 Element* element, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 118 EventDelegate* event_delegate) | 98 EventDelegate* event_delegate) |
| 119 : KeyframeEffectReadOnly(target, model, timing, priority, event_delegate) {} | 99 : KeyframeEffectReadOnly(target, model, timing, priority, event_delegate) {} |
| 120 | 100 |
| 121 KeyframeEffect::~KeyframeEffect() {} | 101 KeyframeEffect::~KeyframeEffect() {} |
| 122 | 102 |
| 123 AnimationEffectTiming* KeyframeEffect::timing() { | 103 AnimationEffectTiming* KeyframeEffect::timing() { |
| 124 return AnimationEffectTiming::Create(this); | 104 return AnimationEffectTiming::Create(this); |
| 125 } | 105 } |
| 126 | 106 |
| 127 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |