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

Side by Side Diff: Source/core/css/parser/CSSParserImpl.cpp

Issue 1319343004: Add property parser code path based on CSSParserTokenRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSParserImpl.h" 6 #include "core/css/parser/CSSParserImpl.h"
7 7
8 #include "core/css/CSSKeyframesRule.h" 8 #include "core/css/CSSKeyframesRule.h"
9 #include "core/css/CSSStyleSheet.h" 9 #include "core/css/CSSStyleSheet.h"
10 #include "core/css/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return; 704 return;
705 705
706 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn d), unresolvedProperty, important, ruleType); 706 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn d), unresolvedProperty, important, ruleType);
707 } 707 }
708 708
709 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper tyID unresolvedProperty, bool important, StyleRule::Type ruleType) 709 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper tyID unresolvedProperty, bool important, StyleRule::Type ruleType)
710 { 710 {
711 CSSParserValueList valueList(range); 711 CSSParserValueList valueList(range);
712 if (!valueList.size()) 712 if (!valueList.size())
713 return; // Parser error 713 return; // Parser error
714 CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, m_c ontext, m_parsedProperties, ruleType); 714 CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, &ra nge, m_context, m_parsedProperties, ruleType);
715 } 715 }
716 716
717 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR ange range) 717 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR ange range)
718 { 718 {
719 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); 719 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>);
720 while (true) { 720 while (true) {
721 range.consumeWhitespace(); 721 range.consumeWhitespace();
722 const CSSParserToken& token = range.consumeIncludingWhitespace(); 722 const CSSParserToken& token = range.consumeIncludingWhitespace();
723 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke n.numericValue() <= 100) 723 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke n.numericValue() <= 100)
724 result->append(token.numericValue() / 100); 724 result->append(token.numericValue() / 100);
725 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr om")) 725 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr om"))
726 result->append(0); 726 result->append(0);
727 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to ")) 727 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to "))
728 result->append(1); 728 result->append(1);
729 else 729 else
730 return nullptr; // Parser error, invalid value in keyframe selector 730 return nullptr; // Parser error, invalid value in keyframe selector
731 if (range.atEnd()) 731 if (range.atEnd())
732 return result.release(); 732 return result.release();
733 if (range.consume().type() != CommaToken) 733 if (range.consume().type() != CommaToken)
734 return nullptr; // Parser error 734 return nullptr; // Parser error
735 } 735 }
736 } 736 }
737 737
738 } // namespace blink 738 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/parser/CSSParserToken.h » ('j') | Source/core/css/parser/CSSPropertyParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698