| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/SampledEffect.h" | 6 #include "core/animation/SampledEffect.h" |
| 7 | 7 |
| 8 #include "core/animation/InterpolationEnvironment.h" | 8 #include "core/animation/InterpolationEnvironment.h" |
| 9 #include "core/animation/InvalidatableInterpolation.h" | 9 #include "core/animation/InvalidatableInterpolation.h" |
| 10 #include "core/animation/SVGInterpolation.h" | 10 #include "core/animation/SVGInterpolation.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 m_animation = nullptr; | 26 m_animation = nullptr; |
| 27 m_interpolations.clear(); | 27 m_interpolations.clear(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 DEFINE_TRACE(SampledEffect) | 30 DEFINE_TRACE(SampledEffect) |
| 31 { | 31 { |
| 32 visitor->trace(m_effect); | 32 visitor->trace(m_effect); |
| 33 visitor->trace(m_animation); | 33 visitor->trace(m_animation); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void SampledEffect::applySVGUpdate(SVGElement& targetElement) | |
| 37 { | |
| 38 for (const auto& interpolation : m_interpolations) { | |
| 39 if (interpolation->isSVGInterpolation()) { | |
| 40 toSVGInterpolation(interpolation.get())->apply(targetElement); | |
| 41 } else if (interpolation->isInvalidatableInterpolation()) { | |
| 42 const InvalidatableInterpolation& invalidatableInterpolation = toInv
alidatableInterpolation(*interpolation); | |
| 43 if (invalidatableInterpolation.property().isSVGAttribute()) { | |
| 44 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> propertyBase = targe
tElement.propertyFromAttribute(invalidatableInterpolation.property().svgAttribut
e()); | |
| 45 InterpolationEnvironment environment(targetElement, *propertyBas
e); | |
| 46 ActiveInterpolations activeInterpolations(1); | |
| 47 activeInterpolations[0] = interpolation.get(); | |
| 48 InvalidatableInterpolation::applyStack(activeInterpolations, env
ironment); | |
| 49 } | |
| 50 } | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | 36 } // namespace blink |
| OLD | NEW |