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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/SampledEffect.cpp
diff --git a/third_party/WebKit/Source/core/animation/SampledEffect.cpp b/third_party/WebKit/Source/core/animation/SampledEffect.cpp
index 30aee7ab143d913f88ab898e5b86e384e2d22815..bad5be900f7b94aefacc5fa42d5d77d87c30c2a6 100644
--- a/third_party/WebKit/Source/core/animation/SampledEffect.cpp
+++ b/third_party/WebKit/Source/core/animation/SampledEffect.cpp
@@ -8,7 +8,6 @@ namespace blink {
SampledEffect::SampledEffect(KeyframeEffect* effect)
: m_effect(effect)
- , m_animation(effect->animation())
, m_sequenceNumber(effect->animation()->sequenceNumber())
, m_priority(effect->priority())
{
@@ -17,14 +16,35 @@ SampledEffect::SampledEffect(KeyframeEffect* effect)
void SampledEffect::clear()
{
m_effect = nullptr;
- m_animation = nullptr;
m_interpolations.clear();
}
+bool SampledEffect::willNeverChange() const
+{
+ return !m_effect || !m_effect->animation();
+}
+
+void SampledEffect::removeReplacedInterpolations(const HashSet<PropertyHandle>& replacedProperties)
+{
+ size_t newSize = 0;
+ for (auto& interpolation : m_interpolations) {
+ if (!replacedProperties.contains(interpolation->property()))
+ m_interpolations[newSize++].swap(interpolation);
+ }
+ m_interpolations.shrink(newSize);
+}
+
+void SampledEffect::updateReplacedProperties(HashSet<PropertyHandle>& replacedProperties)
+{
+ for (const auto& interpolation : m_interpolations) {
+ if (!interpolation->dependsOnUnderlyingValue())
+ replacedProperties.add(interpolation->property());
+ }
+}
+
DEFINE_TRACE(SampledEffect)
{
visitor->trace(m_effect);
- visitor->trace(m_animation);
}
} // namespace blink
« 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