| 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) | |
| 87 if (m_target) | |
| 88 m_target->ensureElementAnimations().addEffect(this); | |
| 89 #endif | |
| 90 } | 86 } |
| 91 | 87 |
| 92 KeyframeEffect::~KeyframeEffect() | 88 KeyframeEffect::~KeyframeEffect() |
| 93 { | 89 { |
| 94 #if !ENABLE(OILPAN) | |
| 95 if (m_target) | |
| 96 m_target->elementAnimations()->notifyEffectDestroyed(this); | |
| 97 #endif | |
| 98 } | 90 } |
| 99 | 91 |
| 100 void KeyframeEffect::attach(Animation* animation) | 92 void KeyframeEffect::attach(Animation* animation) |
| 101 { | 93 { |
| 102 if (m_target) { | 94 if (m_target) { |
| 103 m_target->ensureElementAnimations().animations().add(animation); | 95 m_target->ensureElementAnimations().animations().add(animation); |
| 104 m_target->setNeedsAnimationStyleRecalc(); | 96 m_target->setNeedsAnimationStyleRecalc(); |
| 105 } | 97 } |
| 106 AnimationEffect::attach(animation); | 98 AnimationEffect::attach(animation); |
| 107 } | 99 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 animation()->cancelAnimationOnCompositor(); | 171 animation()->cancelAnimationOnCompositor(); |
| 180 | 172 |
| 181 double iteration = currentIteration(); | 173 double iteration = currentIteration(); |
| 182 ASSERT(iteration >= 0); | 174 ASSERT(iteration >= 0); |
| 183 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte
rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt
r; | 175 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte
rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt
r; |
| 184 // FIXME: Handle iteration values which overflow int. | 176 // FIXME: Handle iteration values which overflow int. |
| 185 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati
on(), interpolations); | 177 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati
on(), interpolations); |
| 186 if (m_sampledEffect) { | 178 if (m_sampledEffect) { |
| 187 m_sampledEffect->setInterpolations(interpolations.release()); | 179 m_sampledEffect->setInterpolations(interpolations.release()); |
| 188 } else if (interpolations && !interpolations->isEmpty()) { | 180 } else if (interpolations && !interpolations->isEmpty()) { |
| 189 OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(
this, interpolations.release()); | 181 SampledEffect* sampledEffect = SampledEffect::create(this, interpolation
s.release()); |
| 190 m_sampledEffect = sampledEffect.get(); | 182 m_sampledEffect = sampledEffect; |
| 191 ensureAnimationStack(m_target).add(sampledEffect.release()); | 183 ensureAnimationStack(m_target).add(sampledEffect); |
| 192 } else { | 184 } else { |
| 193 return; | 185 return; |
| 194 } | 186 } |
| 195 | 187 |
| 196 m_target->setNeedsAnimationStyleRecalc(); | 188 m_target->setNeedsAnimationStyleRecalc(); |
| 197 if (m_target->isSVGElement()) | 189 if (m_target->isSVGElement()) |
| 198 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); | 190 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); |
| 199 } | 191 } |
| 200 | 192 |
| 201 void KeyframeEffect::clearEffects() | 193 void KeyframeEffect::clearEffects() |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 361 |
| 370 DEFINE_TRACE(KeyframeEffect) | 362 DEFINE_TRACE(KeyframeEffect) |
| 371 { | 363 { |
| 372 visitor->trace(m_target); | 364 visitor->trace(m_target); |
| 373 visitor->trace(m_model); | 365 visitor->trace(m_model); |
| 374 visitor->trace(m_sampledEffect); | 366 visitor->trace(m_sampledEffect); |
| 375 AnimationEffect::trace(visitor); | 367 AnimationEffect::trace(visitor); |
| 376 } | 368 } |
| 377 | 369 |
| 378 } // namespace blink | 370 } // namespace blink |
| OLD | NEW |