Chromium Code Reviews| Index: Source/core/css/resolver/StyleResolver.cpp |
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
| index 658cd7cbc0972786a38396033b126a077f73ede4..582fff7ea28566b9126d3292a3e8c2adbfa3807d 100644 |
| --- a/Source/core/css/resolver/StyleResolver.cpp |
| +++ b/Source/core/css/resolver/StyleResolver.cpp |
| @@ -858,6 +858,25 @@ void StyleResolver::keyframeStylesForAnimation(Element* e, const RenderStyle& el |
| } |
| } |
| +// This function is used by the WebAnimations JavaScript API method animate(). |
| +PassRefPtr<KeyframeAnimationEffect> StyleResolver::createKeyframeAnimationEffect(Element* element, const Vector<RefPtr<MutableStylePropertySet> >& propertySetVector, KeyframeAnimationEffect::KeyframeVector& keyframes) |
|
esprehn
2013/12/11 00:26:11
Element&
rjwright
2013/12/11 03:12:12
Done.
|
| +{ |
| + ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| + ASSERT(propertySetVector.size() == keyframes.size()); |
| + |
| + StyleResolverState state(element->document(), element); |
|
esprehn
2013/12/11 00:26:11
This method should probably not be static, you wan
|
| + state.setStyle(RenderStyle::create()); |
| + |
| + for (unsigned i = 0; i < propertySetVector.size(); ++i) { |
| + for (unsigned j = 0; j < propertySetVector[i]->propertyCount(); ++j) { |
| + CSSPropertyID id = propertySetVector[i]->propertyAt(j).id(); |
| + StyleBuilder::applyProperty(id, state, propertySetVector[i]->getPropertyCSSValue(id).get()); |
| + keyframes[i]->setPropertyValue(id, CSSAnimatableValueFactory::create(id, *state.style()).get()); |
| + } |
| + } |
| + return KeyframeAnimationEffect::create(keyframes); |
| +} |
| + |
| PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) |
| { |
| ASSERT(document().frame()); |