Chromium Code Reviews| Index: Source/core/animation/EffectInput.cpp |
| diff --git a/Source/core/animation/EffectInput.cpp b/Source/core/animation/EffectInput.cpp |
| index 87d1c293a505ae71bd63003515fc86cce3bf9f6e..5fe0155a1e8b5b8db032248c58b517815baa81b9 100644 |
| --- a/Source/core/animation/EffectInput.cpp |
| +++ b/Source/core/animation/EffectInput.cpp |
| @@ -33,39 +33,34 @@ |
| #include "bindings/v8/Dictionary.h" |
| #include "core/animation/AnimationHelpers.h" |
| -#include "core/animation/css/CSSAnimations.h" |
| +#include "core/animation/KeyframeEffectModel.h" |
| +#include "core/animation/StringKeyframe.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) |
| +static bool checkDocumentAndRenderer(Element& element) |
| { |
| - if (!element->inActiveDocument()) |
| + if (!element.inActiveDocument()) |
| return false; |
| - element->document().updateRenderTreeIfNeeded(); |
| - return element->renderer(); |
| + element.document().updateRenderTreeIfNeeded(); |
|
esprehn
2014/04/04 22:37:12
I assume you're going to remove this eventually?
shans
2014/04/06 20:25:30
Yeah. Alan: FIXME?
alancutter (OOO until 2018)
2014/04/07 00:02:26
Added FIXME.
|
| + return element.renderer(); |
| } |
| -PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState, bool unsafe) |
| +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. |
| - if (!unsafe && !checkDocumentAndRenderer(element)) |
| + if (!unsafe && !checkDocumentAndRenderer(*element)) |
| return nullptr; |
| StyleSheetContents* styleSheetContents = element->document().elementSheet().contents(); |
| - |
| - // FIXME: Move this code into KeyframeEffectModel, it will be used by the IDL constructor for that class. |
| - AnimatableValueKeyframeVector keyframes; |
| - WillBeHeapVector<RefPtrWillBeMember<MutableStylePropertySet> > propertySetVector; |
| + StringKeyframeVector keyframes; |
| for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { |
| - RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePropertySet::create(); |
| - propertySetVector.append(propertySet); |
| - |
| - RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKeyframe::create(); |
| + RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); |
| keyframes.append(keyframe); |
| double offset; |
| @@ -86,31 +81,23 @@ 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, false, styleSheetContents); |
| + keyframe->setPropertyValue(id, value, styleSheetContents); |
| } |
| } |
| - // FIXME: Replace this with code that just parses, when that code is available. |
| - RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> keyframeEffectModel = StyleResolver::createKeyframeEffectModel(*element, propertySetVector, keyframes); |
| + RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKeyframeEffectModel::create(keyframes); |
| if (!keyframeEffectModel->isReplaceOnly()) { |
| exceptionState.throwDOMException(NotSupportedError, "Partial keyframes are not supported."); |
| return nullptr; |
| } |
| + keyframeEffectModel->forceConversionsToAnimatableValues(element); |
| return keyframeEffectModel; |
| } |