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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "core/animation/KeyframeEffectOptions.h" | 42 #include "core/animation/KeyframeEffectOptions.h" |
43 #include "core/animation/PropertyHandle.h" | 43 #include "core/animation/PropertyHandle.h" |
44 #include "core/dom/Element.h" | 44 #include "core/dom/Element.h" |
45 #include "core/dom/NodeComputedStyle.h" | 45 #include "core/dom/NodeComputedStyle.h" |
46 #include "core/frame/UseCounter.h" | 46 #include "core/frame/UseCounter.h" |
47 #include "core/paint/DeprecatedPaintLayer.h" | 47 #include "core/paint/DeprecatedPaintLayer.h" |
48 #include "core/svg/SVGElement.h" | 48 #include "core/svg/SVGElement.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* target, P
assRefPtrWillBeRawPtr<EffectModel> model, const Timing& timing, Priority priorit
y, PassOwnPtrWillBeRawPtr<EventDelegate> eventDelegate) | 52 KeyframeEffect* KeyframeEffect::create(Element* target, EffectModel* model, cons
t Timing& timing, Priority priority, EventDelegate* eventDelegate) |
53 { | 53 { |
54 return adoptRefWillBeNoop(new KeyframeEffect(target, model, timing, priority
, eventDelegate)); | 54 return new KeyframeEffect(target, model, timing, priority, eventDelegate); |
55 } | 55 } |
56 | 56 |
57 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element,
const Vector<Dictionary>& keyframeDictionaryVector, double duration, ExceptionSt
ate& exceptionState) | 57 KeyframeEffect* KeyframeEffect::create(Element* element, const Vector<Dictionary
>& keyframeDictionaryVector, double duration, ExceptionState& exceptionState) |
58 { | 58 { |
59 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 59 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
60 if (element) | 60 if (element) |
61 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectObjectTiming); | 61 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectObjectTiming); |
62 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), TimingInput::convert(duration)); | 62 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), TimingInput::convert(duration)); |
63 } | 63 } |
64 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element,
const Vector<Dictionary>& keyframeDictionaryVector, const KeyframeEffectOptions&
timingInput, ExceptionState& exceptionState) | 64 KeyframeEffect* KeyframeEffect::create(Element* element, const Vector<Dictionary
>& keyframeDictionaryVector, const KeyframeEffectOptions& timingInput, Exception
State& exceptionState) |
65 { | 65 { |
66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
67 if (element) | 67 if (element) |
68 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectObjectTiming); | 68 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectObjectTiming); |
69 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), TimingInput::convert(timingInput)); | 69 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), TimingInput::convert(timingInput)); |
70 } | 70 } |
71 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element,
const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionSta
te) | 71 KeyframeEffect* KeyframeEffect::create(Element* element, const Vector<Dictionary
>& keyframeDictionaryVector, ExceptionState& exceptionState) |
72 { | 72 { |
73 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 73 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
74 if (element) | 74 if (element) |
75 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectNoTiming); | 75 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectNoTiming); |
76 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); | 76 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); |
77 } | 77 } |
78 | 78 |
79 KeyframeEffect::KeyframeEffect(Element* target, PassRefPtrWillBeRawPtr<EffectMod
el> model, const Timing& timing, Priority priority, PassOwnPtrWillBeRawPtr<Event
Delegate> eventDelegate) | 79 KeyframeEffect::KeyframeEffect(Element* target, EffectModel* model, const Timing
& timing, Priority priority, EventDelegate* eventDelegate) |
80 : AnimationEffect(timing, eventDelegate) | 80 : AnimationEffect(timing, eventDelegate) |
81 , m_target(target) | 81 , m_target(target) |
82 , m_model(model) | 82 , m_model(model) |
83 , m_sampledEffect(nullptr) | 83 , m_sampledEffect(nullptr) |
84 , m_priority(priority) | 84 , m_priority(priority) |
85 { | 85 { |
86 #if !ENABLE(OILPAN) | 86 #if !ENABLE(OILPAN) |
87 if (m_target) | 87 if (m_target) |
88 m_target->ensureElementAnimations().addEffect(this); | 88 m_target->ensureElementAnimations().addEffect(this); |
89 #endif | 89 #endif |
90 } | 90 } |
91 | 91 |
92 KeyframeEffect::~KeyframeEffect() | 92 KeyframeEffect::~KeyframeEffect() |
93 { | 93 { |
| 94 } |
| 95 |
| 96 void KeyframeEffect::dispose() |
| 97 { |
94 #if !ENABLE(OILPAN) | 98 #if !ENABLE(OILPAN) |
95 if (m_target) | 99 if (m_target) |
96 m_target->elementAnimations()->notifyEffectDestroyed(this); | 100 m_target->elementAnimations()->notifyEffectDestroyed(this); |
97 #endif | 101 #endif |
98 } | 102 } |
99 | 103 |
100 void KeyframeEffect::attach(Animation* animation) | 104 void KeyframeEffect::attach(Animation* animation) |
101 { | 105 { |
102 if (m_target) { | 106 if (m_target) { |
103 m_target->ensureElementAnimations().animations().add(animation); | 107 m_target->ensureElementAnimations().animations().add(animation); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Cancel composited animation of transform if a motion path has been introd
uced on the element. | 143 // Cancel composited animation of transform if a motion path has been introd
uced on the element. |
140 if (m_target->computedStyle() | 144 if (m_target->computedStyle() |
141 && m_target->computedStyle()->hasMotionPath() | 145 && m_target->computedStyle()->hasMotionPath() |
142 && animation()->hasActiveAnimationsOnCompositor() | 146 && animation()->hasActiveAnimationsOnCompositor() |
143 && animation()->affects(*m_target, CSSPropertyTransform)) { | 147 && animation()->affects(*m_target, CSSPropertyTransform)) { |
144 animation()->cancelAnimationOnCompositor(); | 148 animation()->cancelAnimationOnCompositor(); |
145 } | 149 } |
146 | 150 |
147 double iteration = currentIteration(); | 151 double iteration = currentIteration(); |
148 ASSERT(iteration >= 0); | 152 ASSERT(iteration >= 0); |
149 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte
rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt
r; | 153 HeapVector<Member<Interpolation>>* interpolations = m_sampledEffect ? m_samp
ledEffect->mutableInterpolations() : nullptr; |
150 // FIXME: Handle iteration values which overflow int. | 154 // FIXME: Handle iteration values which overflow int. |
151 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati
on(), interpolations); | 155 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati
on(), interpolations); |
152 if (m_sampledEffect) { | 156 if (m_sampledEffect) { |
153 m_sampledEffect->setInterpolations(interpolations.release()); | 157 m_sampledEffect->setInterpolations(interpolations); |
154 } else if (interpolations && !interpolations->isEmpty()) { | 158 } else if (interpolations && !interpolations->isEmpty()) { |
155 OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(
this, interpolations.release()); | 159 SampledEffect* sampledEffect = SampledEffect::create(this, interpolation
s); |
156 m_sampledEffect = sampledEffect.get(); | 160 m_sampledEffect = sampledEffect; |
157 ensureAnimationStack(m_target).add(sampledEffect.release()); | 161 ensureAnimationStack(m_target).add(sampledEffect); |
158 } else { | 162 } else { |
159 return; | 163 return; |
160 } | 164 } |
161 | 165 |
162 m_target->setNeedsAnimationStyleRecalc(); | 166 m_target->setNeedsAnimationStyleRecalc(); |
163 if (m_target->isSVGElement()) | 167 if (m_target->isSVGElement()) |
164 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); | 168 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); |
165 } | 169 } |
166 | 170 |
167 void KeyframeEffect::clearEffects() | 171 void KeyframeEffect::clearEffects() |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 336 |
333 DEFINE_TRACE(KeyframeEffect) | 337 DEFINE_TRACE(KeyframeEffect) |
334 { | 338 { |
335 visitor->trace(m_target); | 339 visitor->trace(m_target); |
336 visitor->trace(m_model); | 340 visitor->trace(m_model); |
337 visitor->trace(m_sampledEffect); | 341 visitor->trace(m_sampledEffect); |
338 AnimationEffect::trace(visitor); | 342 AnimationEffect::trace(visitor); |
339 } | 343 } |
340 | 344 |
341 } // namespace blink | 345 } // namespace blink |
OLD | NEW |