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

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

Issue 19037003: Re-use CSSParser logic to parse keyframe keys (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 3 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/css/CSSParser-in.cpp ('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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 const Vector<RefPtr<StyleKeyframe> >& keyframes = keyframesRule->keyframes() ; 737 const Vector<RefPtr<StyleKeyframe> >& keyframes = keyframesRule->keyframes() ;
738 for (unsigned i = 0; i < keyframes.size(); ++i) { 738 for (unsigned i = 0; i < keyframes.size(); ++i) {
739 // Apply the declaration to the style. This is a simplified version of t he logic in styleForElement 739 // Apply the declaration to the style. This is a simplified version of t he logic in styleForElement
740 const StyleKeyframe* keyframe = keyframes[i].get(); 740 const StyleKeyframe* keyframe = keyframes[i].get();
741 741
742 KeyframeValue keyframeValue(0, 0); 742 KeyframeValue keyframeValue(0, 0);
743 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, keyframe)); 743 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, keyframe));
744 keyframeValue.addProperties(keyframe->properties()); 744 keyframeValue.addProperties(keyframe->properties());
745 745
746 // Add this keyframe style to all the indicated key times 746 // Add this keyframe style to all the indicated key times
747 Vector<double> keys; 747 const Vector<double>& keys = keyframe->keys();
748 keyframe->getKeys(keys);
749 for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) { 748 for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) {
750 keyframeValue.setKey(keys[keyIndex]); 749 keyframeValue.setKey(keys[keyIndex]);
751 list.insert(keyframeValue); 750 list.insert(keyframeValue);
752 } 751 }
753 } 752 }
754 753
755 // If the 0% keyframe is missing, create it (but only if there is at least o ne other keyframe) 754 // If the 0% keyframe is missing, create it (but only if there is at least o ne other keyframe)
756 int initialListSize = list.size(); 755 int initialListSize = list.size();
757 if (initialListSize > 0 && list[0].key()) { 756 if (initialListSize > 0 && list[0].key()) {
758 static StyleKeyframe* zeroPercentKeyframe; 757 static StyleKeyframe* zeroPercentKeyframe;
(...skipping 26 matching lines...) Expand all
785 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled()); 784 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
786 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name); 785 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name);
787 if (!keyframesRule) 786 if (!keyframesRule)
788 return; 787 return;
789 788
790 // Construct and populate the style for each keyframe 789 // Construct and populate the style for each keyframe
791 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); 790 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
792 for (size_t i = 0; i < styleKeyframes.size(); ++i) { 791 for (size_t i = 0; i < styleKeyframes.size(); ++i) {
793 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); 792 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
794 RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(0, style, styleKeyf rame); 793 RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(0, style, styleKeyf rame);
795 Vector<double> offsets; 794 const Vector<double>& offsets = styleKeyframe->keys();
796 styleKeyframe->getKeys(offsets);
797 RefPtr<Keyframe> firstOffsetKeyframe; 795 RefPtr<Keyframe> firstOffsetKeyframe;
798 for (size_t j = 0; j < offsets.size(); ++j) { 796 for (size_t j = 0; j < offsets.size(); ++j) {
799 RefPtr<Keyframe> keyframe = Keyframe::create(); 797 RefPtr<Keyframe> keyframe = Keyframe::create();
800 keyframe->setOffset(offsets[j]); 798 keyframe->setOffset(offsets[j]);
801 const StylePropertySet* properties = styleKeyframe->properties(); 799 const StylePropertySet* properties = styleKeyframe->properties();
802 for (unsigned k = 0; k < properties->propertyCount(); k++) { 800 for (unsigned k = 0; k < properties->propertyCount(); k++) {
803 CSSPropertyID property = properties->propertyAt(k).id(); 801 CSSPropertyID property = properties->propertyAt(k).id();
804 // FIXME: Build the correct chained timing function when this pr operty is specified. 802 // FIXME: Build the correct chained timing function when this pr operty is specified.
805 if (property == CSSPropertyWebkitAnimationTimingFunction || prop erty == CSSPropertyAnimationTimingFunction) 803 if (property == CSSPropertyWebkitAnimationTimingFunction || prop erty == CSSPropertyAnimationTimingFunction)
806 continue; 804 continue;
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1511 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1514 1512
1515 fprintf(stderr, "Total:\n"); 1513 fprintf(stderr, "Total:\n");
1516 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1514 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1517 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1515 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1518 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1516 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1519 } 1517 }
1520 #endif 1518 #endif
1521 1519
1522 } // namespace WebCore 1520 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser-in.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698