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" |
| 9 #include "core/animation/InvalidatableInterpolation.h" |
8 #include "core/animation/SVGInterpolation.h" | 10 #include "core/animation/SVGInterpolation.h" |
9 #include "core/animation/StyleInterpolation.h" | |
10 #include "core/svg/SVGElement.h" | 11 #include "core/svg/SVGElement.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 SampledEffect::SampledEffect(KeyframeEffect* effect) | 15 SampledEffect::SampledEffect(KeyframeEffect* effect) |
15 : m_effect(effect) | 16 : m_effect(effect) |
16 , m_animation(effect->animation()) | 17 , m_animation(effect->animation()) |
17 , m_sequenceNumber(effect->animation()->sequenceNumber()) | 18 , m_sequenceNumber(effect->animation()->sequenceNumber()) |
18 , m_priority(effect->priority()) | 19 , m_priority(effect->priority()) |
19 { | 20 { |
(...skipping 10 matching lines...) Expand all Loading... |
30 { | 31 { |
31 visitor->trace(m_effect); | 32 visitor->trace(m_effect); |
32 visitor->trace(m_animation); | 33 visitor->trace(m_animation); |
33 } | 34 } |
34 | 35 |
35 void SampledEffect::applySVGUpdate(SVGElement& targetElement) | 36 void SampledEffect::applySVGUpdate(SVGElement& targetElement) |
36 { | 37 { |
37 for (const auto& interpolation : m_interpolations) { | 38 for (const auto& interpolation : m_interpolations) { |
38 if (interpolation->isSVGInterpolation()) { | 39 if (interpolation->isSVGInterpolation()) { |
39 toSVGInterpolation(interpolation.get())->apply(targetElement); | 40 toSVGInterpolation(interpolation.get())->apply(targetElement); |
| 41 } else if (interpolation->isInvalidatableInterpolation()) { |
| 42 const InvalidatableInterpolation& invalidatableInterpolation = toInv
alidatableInterpolation(*interpolation); |
| 43 if (invalidatableInterpolation.property().isSVGAttribute()) { |
| 44 const SVGPropertyBase& baseValue = targetElement.propertyFromAtt
ribute(invalidatableInterpolation.property().svgAttribute())->baseValueBase(); |
| 45 InterpolationEnvironment environment(targetElement, baseValue); |
| 46 ActiveInterpolations activeInterpolations(1); |
| 47 activeInterpolations[0] = interpolation.get(); |
| 48 InvalidatableInterpolation::applyStack(activeInterpolations, env
ironment); |
| 49 } |
40 } | 50 } |
41 } | 51 } |
42 } | 52 } |
43 | 53 |
44 } // namespace blink | 54 } // namespace blink |
OLD | NEW |