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

Unified Diff: Source/core/animation/KeyframeEffectModel.cpp

Issue 203463009: Web Animations API: Fix Synthetic keyframes + partial keyframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add assert for CompositeOperation replace in ensureKeyframeGroups() Created 6 years, 9 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 | « no previous file | Source/core/animation/KeyframeEffectModelTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/KeyframeEffectModel.cpp
diff --git a/Source/core/animation/KeyframeEffectModel.cpp b/Source/core/animation/KeyframeEffectModel.cpp
index b6f813f8ada431190082cdb48cad2f8ada85ca79..860452c01879ecefb52197031b3a2f187d688745 100644
--- a/Source/core/animation/KeyframeEffectModel.cpp
+++ b/Source/core/animation/KeyframeEffectModel.cpp
@@ -205,6 +205,7 @@ void KeyframeEffectModel::ensureKeyframeGroups() const
else
group = groupIter->value.get();
+ ASSERT(keyframe->composite() == AnimationEffect::CompositeReplace);
group->appendKeyframe(adoptPtr(
new PropertySpecificKeyframe(keyframe->offset(), keyframe->easing(), keyframe->propertyValue(property), keyframe->composite())));
}
@@ -247,7 +248,6 @@ KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o
: m_offset(offset)
, m_easing(easing)
{
- ASSERT(composite == AnimationEffect::CompositeReplace);
m_value = AnimatableValue::takeConstRef(value);
shans 2014/03/19 09:06:20 Store composite in an m_composite member variable
}
@@ -293,21 +293,10 @@ void KeyframeEffectModel::PropertySpecificKeyframeGroup::removeRedundantKeyframe
void KeyframeEffectModel::PropertySpecificKeyframeGroup::addSyntheticKeyframeIfRequired()
{
ASSERT(!m_keyframes.isEmpty());
- double offset = m_keyframes.first()->offset();
- bool allOffsetsEqual = true;
- for (PropertySpecificKeyframeVector::const_iterator iter = m_keyframes.begin() + 1; iter != m_keyframes.end(); ++iter) {
- if ((*iter)->offset() != offset) {
- allOffsetsEqual = false;
- break;
- }
- }
- if (!allOffsetsEqual)
- return;
-
- if (!offset)
- appendKeyframe(m_keyframes.first()->cloneWithOffset(1.0));
- else
- m_keyframes.insert(0, adoptPtr(new PropertySpecificKeyframe(0.0, nullptr, AnimatableValue::neutralValue(), CompositeAdd)));
+ if (m_keyframes.first()->offset() != 0.0)
+ m_keyframes.insert(0, adoptPtr(new PropertySpecificKeyframe(0, nullptr, AnimatableValue::neutralValue(), CompositeAdd)));
+ if (m_keyframes.last()->offset() != 1.0)
+ appendKeyframe(adoptPtr(new PropertySpecificKeyframe(1, nullptr, AnimatableValue::neutralValue(), CompositeAdd)));
}
void KeyframeEffectModel::trace(Visitor* visitor)
« no previous file with comments | « no previous file | Source/core/animation/KeyframeEffectModelTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698