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); |
} |