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

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

Issue 190763007: [WIP] Web Animations API: Constructing an Animation from partial keyframes throws a JS exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « Source/core/animation/EffectInput.h ('k') | Source/core/animation/ElementAnimation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/EffectInput.cpp
diff --git a/Source/core/animation/EffectInput.cpp b/Source/core/animation/EffectInput.cpp
index 2f87c28e668d7f864803948083a75f07a80e13f9..146d1ee5d6a709fa5305c2c8dd637cb5ffecd151 100644
--- a/Source/core/animation/EffectInput.cpp
+++ b/Source/core/animation/EffectInput.cpp
@@ -48,7 +48,23 @@ static bool checkDocumentAndRenderer(Element* element)
return element->renderer();
}
-PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, bool unsafe)
+static bool hasPartialKeyframe(Vector<RefPtr<MutableStylePropertySet> > propertySetVector)
+{
+ HashCountedSet<CSSPropertyID> counter;
+ for (size_t i = 0; i < propertySetVector.size(); ++i) {
+ for (size_t j = 0; j < propertySetVector[i]->propertyCount(); ++j) {
+ CSSPropertyID property = propertySetVector[i]->propertyAt(j).id();
+ counter.add(property);
+ }
+ }
+ for (HashCountedSet<CSSPropertyID>::iterator iterator = counter.begin(); iterator != counter.end(); ++iterator) {
+ if (iterator->value == 1)
+ return true;
+ }
+ return false;
+}
shans 2014/03/10 23:28:40 This won't pick up cases like: element.animate(
rjwright 2014/03/10 23:35:37 It is meant to?
rjwright 2014/03/11 01:48:42 Done.
+
+PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState, bool unsafe)
{
// FIXME: This test will not be neccessary once resolution of keyframe values occurs at
// animation application time.
@@ -103,6 +119,11 @@ PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
}
}
+ // FIXME: Web Animations can't yet handle keyframe sets where a property appears in only one keyframe (called "partial keyframes").
+ // This check can be removed once support for such inputs is added.
+ if (hasPartialKeyframe(propertySetVector))
+ exceptionState.throwDOMException(NotSupportedError, "Keyframe effect contains properties that appear in only one keyframe.");
+
// FIXME: Replace this with code that just parses, when that code is available.
return StyleResolver::createKeyframeEffectModel(*element, propertySetVector, keyframes);
}
« no previous file with comments | « Source/core/animation/EffectInput.h ('k') | Source/core/animation/ElementAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698