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

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

Issue 22364002: Web Animations: Address some review feedback to clean up CSS Animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « Source/core/animation/css/CSSAnimations.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 } 758 }
759 KeyframeValue keyframeValue(1, 0); 759 KeyframeValue keyframeValue(1, 0);
760 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe)); 760 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe));
761 keyframeValue.addProperties(hundredPercentKeyframe->properties()); 761 keyframeValue.addProperties(hundredPercentKeyframe->properties());
762 list.insert(keyframeValue); 762 list.insert(keyframeValue);
763 } 763 }
764 } 764 }
765 765
766 void StyleResolver::resolveKeyframes(Element* element, const RenderStyle* style, const StringImpl* name, KeyframeAnimationEffect::KeyframeVector& keyframes) 766 void StyleResolver::resolveKeyframes(Element* element, const RenderStyle* style, const StringImpl* name, KeyframeAnimationEffect::KeyframeVector& keyframes)
767 { 767 {
768 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
768 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name); 769 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name);
769 if (!keyframesRule) 770 if (!keyframesRule)
770 return; 771 return;
771 772
772 // Construct and populate the style for each keyframe 773 // Construct and populate the style for each keyframe
773 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); 774 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
774 for (unsigned i = 0; i < styleKeyframes.size(); ++i) { 775 for (unsigned i = 0; i < styleKeyframes.size(); ++i) {
775 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); 776 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
776 RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(element, style, sty leKeyframe); 777 RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(element, style, sty leKeyframe);
777 778
(...skipping 12 matching lines...) Expand all
790 keyframes.append(keyframe); 791 keyframes.append(keyframe);
791 } 792 }
792 } 793 }
793 794
794 // FIXME: If the 0% keyframe is missing, create it (but only if there is at least one other keyframe) 795 // FIXME: If the 0% keyframe is missing, create it (but only if there is at least one other keyframe)
795 // FIXME: If the 100% keyframe is missing, create it (but only if there is a t least one other keyframe) 796 // FIXME: If the 100% keyframe is missing, create it (but only if there is a t least one other keyframe)
796 } 797 }
797 798
798 const StylePropertySet* StyleResolver::firstKeyframeStyles(const Element* elemen t, const StringImpl* animationName) 799 const StylePropertySet* StyleResolver::firstKeyframeStyles(const Element* elemen t, const StringImpl* animationName)
799 { 800 {
801 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
800 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, animationName); 802 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, animationName);
801 if (!keyframesRule) 803 if (!keyframesRule)
802 return 0; 804 return 0;
803 805
804 // Find the last keyframe at offset 0 806 // Find the last keyframe at offset 0
805 const StyleKeyframe* firstKeyframe = 0; 807 const StyleKeyframe* firstKeyframe = 0;
806 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); 808 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
807 for (unsigned i = 0; i < styleKeyframes.size(); ++i) { 809 for (unsigned i = 0; i < styleKeyframes.size(); ++i) {
808 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); 810 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
809 811
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1039
1038 return collector.matchedRuleList(); 1040 return collector.matchedRuleList();
1039 } 1041 }
1040 1042
1041 // ----------------------------------------------------------------------------- -------- 1043 // ----------------------------------------------------------------------------- --------
1042 // this is mostly boring stuff on how to apply a certain rule to the renderstyle ... 1044 // this is mostly boring stuff on how to apply a certain rule to the renderstyle ...
1043 1045
1044 template <StyleResolver::StyleApplicationPass pass> 1046 template <StyleResolver::StyleApplicationPass pass>
1045 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* target, const DocumentTimeline* timeline, const CSSAnimationUpdate* update ) 1047 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* target, const DocumentTimeline* timeline, const CSSAnimationUpdate* update )
1046 { 1048 {
1049 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
1047 ASSERT(pass != VariableDefinitions); 1050 ASSERT(pass != VariableDefinitions);
1048 ASSERT(pass != AnimationProperties); 1051 ASSERT(pass != AnimationProperties);
1049 if (update && update->styles()) { 1052 if (update && update->styles()) {
1050 bool applyInheritedOnly = false; 1053 bool applyInheritedOnly = false;
1051 bool isImportant = false; 1054 bool isImportant = false;
1052 StyleRule* rule = 0; 1055 StyleRule* rule = 0;
1053 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone); 1056 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone);
1054 isImportant = true; 1057 isImportant = true;
1055 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone); 1058 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone);
1056 } 1059 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1435 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1433 1436
1434 fprintf(stderr, "Total:\n"); 1437 fprintf(stderr, "Total:\n");
1435 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1438 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1436 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1439 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1437 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1440 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1438 } 1441 }
1439 #endif 1442 #endif
1440 1443
1441 } // namespace WebCore 1444 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSAnimations.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698