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

Side by Side Diff: Source/core/css/resolver/StyleResolver.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 unified diff | Download patch | Annotate | Revision Log
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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 787 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
788 document().styleEngine()->fontSelector()->loadPendingFonts(); 788 document().styleEngine()->fontSelector()->loadPendingFonts();
789 789
790 didAccess(); 790 didAccess();
791 791
792 return state.takeStyle(); 792 return state.takeStyle();
793 } 793 }
794 794
795 // This function is used by the WebAnimations JavaScript API method animate(). 795 // This function is used by the WebAnimations JavaScript API method animate().
796 // FIXME: Remove this when animate() switches away from resolution-dependent par sing. 796 // FIXME: Remove this when animate() switches away from resolution-dependent par sing.
797 PassRefPtrWillBeRawPtr<AVKeyframeEffectModel> StyleResolver::createKeyframeEffec tModel(Element& element, const Vector<RefPtr<MutableStylePropertySet> >& propert ySetVector, AVKeyframeVector& keyframes) 797 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element & element, RenderStyle& style, CSSPropertyID property, CSSValue* value)
798 { 798 {
799 ASSERT(propertySetVector.size() == keyframes.size());
800
801 StyleResolverState state(element.document(), &element); 799 StyleResolverState state(element.document(), &element);
802 state.setStyle(RenderStyle::create()); 800 state.setStyle(&style);
803 801 StyleBuilder::applyProperty(property, state, value);
804 for (unsigned i = 0; i < propertySetVector.size(); ++i) { 802 return CSSAnimatableValueFactory::create(property, style);
805 for (unsigned j = 0; j < propertySetVector[i]->propertyCount(); ++j) {
806 CSSPropertyID id = propertySetVector[i]->propertyAt(j).id();
807 StyleBuilder::applyProperty(id, state, propertySetVector[i]->getProp ertyCSSValue(id).get());
808 keyframes[i]->setPropertyValue(id, CSSAnimatableValueFactory::create (id, *state.style()).get());
809 }
810 }
811 return AVKeyframeEffectModel::create(keyframes);
812 } 803 }
813 804
814 PassRefPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded(Element& pa rent, PseudoId pseudoId) 805 PassRefPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded(Element& pa rent, PseudoId pseudoId)
815 { 806 {
816 RenderObject* parentRenderer = parent.renderer(); 807 RenderObject* parentRenderer = parent.renderer();
817 if (!parentRenderer) 808 if (!parentRenderer)
818 return nullptr; 809 return nullptr;
819 810
820 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId)) 811 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId))
821 return nullptr; 812 return nullptr;
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1398 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1408 { 1399 {
1409 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1400 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1410 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1401 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1411 return true; 1402 return true;
1412 } 1403 }
1413 return false; 1404 return false;
1414 } 1405 }
1415 1406
1416 } // namespace WebCore 1407 } // namespace WebCore
OLDNEW
« Source/core/animation/KeyframeEffectModel.cpp ('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