Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: third_party/WebKit/Source/core/animation/SampledEffect.cpp

Issue 1698093005: Discard SampledEffects on elements if they are redundant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_renameToSampledEffect
Patch Set: Rebased Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698