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 "core/animation/SampledEffect.h" | 5 #include "core/animation/SampledEffect.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 SampledEffect::SampledEffect(KeyframeEffect* effect) | 9 SampledEffect::SampledEffect(KeyframeEffect* effect) |
10 : m_effect(effect) | 10 : m_effect(effect) |
11 , m_animation(effect->animation()) | |
12 , m_sequenceNumber(effect->animation()->sequenceNumber()) | 11 , m_sequenceNumber(effect->animation()->sequenceNumber()) |
13 , m_priority(effect->priority()) | 12 , m_priority(effect->priority()) |
14 { | 13 { |
15 } | 14 } |
16 | 15 |
17 void SampledEffect::clear() | 16 void SampledEffect::clear() |
18 { | 17 { |
19 m_effect = nullptr; | 18 m_effect = nullptr; |
20 m_animation = nullptr; | |
21 m_interpolations.clear(); | 19 m_interpolations.clear(); |
22 } | 20 } |
23 | 21 |
| 22 bool SampledEffect::willNeverChange() const |
| 23 { |
| 24 return !m_effect || !m_effect->animation(); |
| 25 } |
| 26 |
| 27 void SampledEffect::removeReplacedInterpolations(const HashSet<PropertyHandle>&
replacedProperties) |
| 28 { |
| 29 size_t newSize = 0; |
| 30 for (auto& interpolation : m_interpolations) { |
| 31 if (!replacedProperties.contains(interpolation->property())) |
| 32 m_interpolations[newSize++].swap(interpolation); |
| 33 } |
| 34 m_interpolations.shrink(newSize); |
| 35 } |
| 36 |
| 37 void SampledEffect::updateReplacedProperties(HashSet<PropertyHandle>& replacedPr
operties) |
| 38 { |
| 39 for (const auto& interpolation : m_interpolations) { |
| 40 if (!interpolation->dependsOnUnderlyingValue()) |
| 41 replacedProperties.add(interpolation->property()); |
| 42 } |
| 43 } |
| 44 |
24 DEFINE_TRACE(SampledEffect) | 45 DEFINE_TRACE(SampledEffect) |
25 { | 46 { |
26 visitor->trace(m_effect); | 47 visitor->trace(m_effect); |
27 visitor->trace(m_animation); | |
28 } | 48 } |
29 | 49 |
30 } // namespace blink | 50 } // namespace blink |
OLD | NEW |