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

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

Issue 194733002: Web Animations: Use StringKeyframes for element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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
Index: Source/core/animation/EffectInput.cpp
diff --git a/Source/core/animation/EffectInput.cpp b/Source/core/animation/EffectInput.cpp
index 19725607575af65756a5c2652207dd8a4412ddfd..74e7de348939754802b9f8b375482c5ed0d1a05c 100644
--- a/Source/core/animation/EffectInput.cpp
+++ b/Source/core/animation/EffectInput.cpp
@@ -33,36 +33,19 @@
#include "bindings/v8/Dictionary.h"
#include "core/animation/AnimationHelpers.h"
-#include "core/animation/css/CSSAnimations.h"
+#include "core/animation/KeyframeEffectModel.h"
#include "core/css/parser/BisonCSSParser.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Element.h"
namespace WebCore {
-static bool checkDocumentAndRenderer(Element* element)
-{
- if (!element->inActiveDocument())
- return false;
- element->document().updateStyleIfNeeded();
- return element->renderer();
-}
-
PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, bool unsafe)
{
- // FIXME: This test will not be neccessary once resolution of keyframe values occurs at
- // animation application time.
- if (!unsafe && !checkDocumentAndRenderer(element))
- return nullptr;
-
- AVKeyframeVector keyframes;
- Vector<RefPtr<MutableStylePropertySet> > propertySetVector;
+ SKeyframeVector keyframes;
for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) {
- RefPtr<MutableStylePropertySet> propertySet = MutableStylePropertySet::create();
- propertySetVector.append(propertySet);
-
- RefPtrWillBeRawPtr<AVKeyframe> keyframe = AVKeyframe::create();
+ RefPtrWillBeRawPtr<SKeyframe> keyframe = SKeyframe::create();
keyframes.append(keyframe);
double offset;
@@ -85,28 +68,18 @@ PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
Vector<String> keyframeProperties;
keyframeDictionaryVector[i].getOwnPropertyNames(keyframeProperties);
-
for (size_t j = 0; j < keyframeProperties.size(); ++j) {
String property = keyframeProperties[j];
CSSPropertyID id = camelCaseCSSPropertyNameToID(property);
-
- // FIXME: There is no way to store invalid properties or invalid values
- // in a Keyframe object, so for now I just skip over them. Eventually we
- // will need to support getFrames(), which should return exactly the
- // keyframes that were input through the API. We will add a layer to wrap
- // KeyframeEffectModel, store input keyframes and implement getFrames.
- if (id == CSSPropertyInvalid || !CSSAnimations::isAnimatableProperty(id))
+ if (id == CSSPropertyInvalid)
continue;
-
String value;
keyframeDictionaryVector[i].get(property, value);
- propertySet->setProperty(id, value);
+ keyframe->setPropertyValue(id, value);
}
}
- // FIXME: Replace this with code that just parses, when that code is available.
- RefPtrWillBeRawPtr<AVKeyframeEffectModel> effect = StyleResolver::createKeyframeEffectModel(*element, propertySetVector, keyframes);
- return effect;
+ return SKeyframeEffectModel::create(*element, keyframes);
}
} // namespace WebCore
« no previous file with comments | « no previous file | Source/core/animation/KeyframeEffectModel.h » ('j') | Source/core/animation/KeyframeEffectModel.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698