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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 96283002: Web Animations API: Start implementation of Element.animate(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout test for animate() Created 7 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 hundredPercentKeyframe = StyleKeyframe::create().leakRef(); 851 hundredPercentKeyframe = StyleKeyframe::create().leakRef();
852 hundredPercentKeyframe->setKeyText("100%"); 852 hundredPercentKeyframe->setKeyText("100%");
853 } 853 }
854 KeyframeValue keyframeValue(1, 0); 854 KeyframeValue keyframeValue(1, 0);
855 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe)); 855 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe));
856 keyframeValue.addProperties(hundredPercentKeyframe->properties()); 856 keyframeValue.addProperties(hundredPercentKeyframe->properties());
857 list.insert(keyframeValue); 857 list.insert(keyframeValue);
858 } 858 }
859 } 859 }
860 860
861 // This function is used by the WebAnimations JavaScript API method animate().
862 void StyleResolver::setKeyframePropertyValues(Element* element, const Vector<Ref Ptr<MutableStylePropertySet> >& propertySetVector, KeyframeAnimationEffect::Keyf rameVector& keyframes)
863 {
864 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
865 ASSERT(propertySetVector.size() == keyframes.size());
866
867 StyleResolverState state(element->document(), element);
868 state.setStyle(RenderStyle::create());
869
870 for (unsigned i = 0; i < propertySetVector.size(); ++i) {
871 for (unsigned j = 0; j < propertySetVector[i]->propertyCount(); ++j) {
872 CSSPropertyID id = propertySetVector[i]->propertyAt(j).id();
873 StyleBuilder::applyProperty(id, state, propertySetVector[i]->getProp ertyCSSValue(id).get());
874 keyframes[i]->setPropertyValue(id, CSSAnimatableValueFactory::create (id, *state.style()).get());
875 }
876 }
877 }
878
861 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 879 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
862 { 880 {
863 ASSERT(document().frame()); 881 ASSERT(document().frame());
864 ASSERT(documentSettings()); 882 ASSERT(documentSettings());
865 ASSERT(parentStyle); 883 ASSERT(parentStyle);
866 if (!e) 884 if (!e)
867 return 0; 885 return 0;
868 886
869 StyleResolverState state(document(), e, parentStyle); 887 StyleResolverState state(document(), e, parentStyle);
870 888
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 bool StyleResolver::affectedByViewportChange() const 1441 bool StyleResolver::affectedByViewportChange() const
1424 { 1442 {
1425 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1443 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1426 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1444 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1427 return true; 1445 return true;
1428 } 1446 }
1429 return false; 1447 return false;
1430 } 1448 }
1431 1449
1432 } // namespace WebCore 1450 } // namespace WebCore
OLDNEW
« Source/core/css/resolver/StyleResolver.h ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698