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

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

Issue 215883005: Web Animations: Introduce String based KeyframeEffectModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 780
781 loadPendingResources(state); 781 loadPendingResources(state);
782 782
783 didAccess(); 783 didAccess();
784 784
785 return state.takeStyle(); 785 return state.takeStyle();
786 } 786 }
787 787
788 // This function is used by the WebAnimations JavaScript API method animate(). 788 // This function is used by the WebAnimations JavaScript API method animate().
789 // FIXME: Remove this when animate() switches away from resolution-dependent par sing. 789 // FIXME: Remove this when animate() switches away from resolution-dependent par sing.
790 PassRefPtrWillBeRawPtr<KeyframeEffectModel> StyleResolver::createKeyframeEffectM odel(Element& element, const WillBeHeapVector<RefPtrWillBeMember<MutableStylePro pertySet> >& propertySetVector, KeyframeEffectModel::KeyframeVector& keyframes) 790 PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> StyleResolver::create KeyframeEffectModel(Element& element, const WillBeHeapVector<RefPtrWillBeMember< MutableStylePropertySet> >& propertySetVector, AnimatableValueKeyframeVector& ke yframes)
791 { 791 {
792 ASSERT(propertySetVector.size() == keyframes.size()); 792 ASSERT(propertySetVector.size() == keyframes.size());
793 793
794 StyleResolverState state(element.document(), &element); 794 StyleResolverState state(element.document(), &element);
795 state.setStyle(RenderStyle::create()); 795 state.setStyle(RenderStyle::create());
796 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules()); 796 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules());
797 797
798 for (unsigned i = 0; i < propertySetVector.size(); ++i) { 798 for (unsigned i = 0; i < propertySetVector.size(); ++i) {
799 for (unsigned j = 0; j < propertySetVector[i]->propertyCount(); ++j) { 799 for (unsigned j = 0; j < propertySetVector[i]->propertyCount(); ++j) {
800 CSSPropertyID id = propertySetVector[i]->propertyAt(j).id(); 800 CSSPropertyID id = propertySetVector[i]->propertyAt(j).id();
801 StyleBuilder::applyProperty(id, state, propertySetVector[i]->getProp ertyCSSValue(id).get()); 801 StyleBuilder::applyProperty(id, state, propertySetVector[i]->getProp ertyCSSValue(id).get());
802 keyframes[i]->setPropertyValue(id, CSSAnimatableValueFactory::create (id, *state.style()).get()); 802 keyframes[i]->setPropertyValue(id, CSSAnimatableValueFactory::create (id, *state.style()).get());
803 } 803 }
804 } 804 }
805 805 return AnimatableValueKeyframeEffectModel::create(keyframes);
806 return KeyframeEffectModel::create(keyframes);
807 } 806 }
808 807
809 PassRefPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded(Element& pa rent, PseudoId pseudoId) 808 PassRefPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded(Element& pa rent, PseudoId pseudoId)
810 { 809 {
811 RenderObject* parentRenderer = parent.renderer(); 810 RenderObject* parentRenderer = parent.renderer();
812 if (!parentRenderer) 811 if (!parentRenderer)
813 return nullptr; 812 return nullptr;
814 813
815 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId)) 814 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId))
816 return nullptr; 815 return nullptr;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1092
1094 template <StyleResolver::StyleApplicationPass pass> 1093 template <StyleResolver::StyleApplicationPass pass>
1095 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo lations) 1094 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo lations)
1096 { 1095 {
1097 ASSERT(pass != AnimationProperties); 1096 ASSERT(pass != AnimationProperties);
1098 1097
1099 for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::c onst_iterator iter = activeInterpolations.begin(); iter != activeInterpolations. end(); ++iter) { 1098 for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::c onst_iterator iter = activeInterpolations.begin(); iter != activeInterpolations. end(); ++iter) {
1100 CSSPropertyID property = iter->key; 1099 CSSPropertyID property = iter->key;
1101 if (!isPropertyForPass<pass>(property)) 1100 if (!isPropertyForPass<pass>(property))
1102 continue; 1101 continue;
1103 const StyleInterpolation *interpolation = toStyleInterpolation(iter->val ue.get()); 1102 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val ue.get());
1104 interpolation->apply(state); 1103 interpolation->apply(state);
1105 } 1104 }
1106 } 1105 }
1107 1106
1108 static inline bool isValidCueStyleProperty(CSSPropertyID id) 1107 static inline bool isValidCueStyleProperty(CSSPropertyID id)
1109 { 1108 {
1110 switch (id) { 1109 switch (id) {
1111 case CSSPropertyBackground: 1110 case CSSPropertyBackground:
1112 case CSSPropertyBackgroundAttachment: 1111 case CSSPropertyBackgroundAttachment:
1113 case CSSPropertyBackgroundClip: 1112 case CSSPropertyBackgroundClip:
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 visitor->trace(m_keyframesRuleMap); 1419 visitor->trace(m_keyframesRuleMap);
1421 visitor->trace(m_viewportDependentMediaQueryResults); 1420 visitor->trace(m_viewportDependentMediaQueryResults);
1422 visitor->trace(m_viewportStyleResolver); 1421 visitor->trace(m_viewportStyleResolver);
1423 visitor->trace(m_siblingRuleSet); 1422 visitor->trace(m_siblingRuleSet);
1424 visitor->trace(m_uncommonAttributeRuleSet); 1423 visitor->trace(m_uncommonAttributeRuleSet);
1425 visitor->trace(m_watchedSelectorsRules); 1424 visitor->trace(m_watchedSelectorsRules);
1426 visitor->trace(m_treeBoundaryCrossingRules); 1425 visitor->trace(m_treeBoundaryCrossingRules);
1427 } 1426 }
1428 1427
1429 } // namespace WebCore 1428 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698