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

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: Patch for landing 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
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/css/parser/CSSParserToken.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "core/css/StyleRuleImport.h" 11 #include "core/css/StyleRuleImport.h"
12 #include "core/css/StyleRuleKeyframe.h" 12 #include "core/css/StyleRuleKeyframe.h"
13 #include "core/css/StyleRuleNamespace.h" 13 #include "core/css/StyleRuleNamespace.h"
14 #include "core/css/StyleSheetContents.h" 14 #include "core/css/StyleSheetContents.h"
15 #include "core/css/parser/CSSParserObserver.h" 15 #include "core/css/parser/CSSParserObserver.h"
16 #include "core/css/parser/CSSParserObserverWrapper.h" 16 #include "core/css/parser/CSSParserObserverWrapper.h"
17 #include "core/css/parser/CSSParserSelector.h" 17 #include "core/css/parser/CSSParserSelector.h"
18 #include "core/css/parser/CSSParserValues.h"
19 #include "core/css/parser/CSSPropertyParser.h" 18 #include "core/css/parser/CSSPropertyParser.h"
20 #include "core/css/parser/CSSSelectorParser.h" 19 #include "core/css/parser/CSSSelectorParser.h"
21 #include "core/css/parser/CSSSupportsParser.h" 20 #include "core/css/parser/CSSSupportsParser.h"
22 #include "core/css/parser/CSSTokenizer.h" 21 #include "core/css/parser/CSSTokenizer.h"
23 #include "core/css/parser/MediaQueryParser.h" 22 #include "core/css/parser/MediaQueryParser.h"
24 #include "core/dom/Document.h" 23 #include "core/dom/Document.h"
25 #include "core/dom/Element.h" 24 #include "core/dom/Element.h"
26 #include "core/frame/UseCounter.h" 25 #include "core/frame/UseCounter.h"
27 #include "platform/TraceEvent.h" 26 #include "platform/TraceEvent.h"
28 #include "wtf/BitArray.h" 27 #include "wtf/BitArray.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 698 }
700 699
701 if (unresolvedProperty == CSSPropertyInvalid) 700 if (unresolvedProperty == CSSPropertyInvalid)
702 return; 701 return;
703 702
704 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn d), unresolvedProperty, important, ruleType); 703 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn d), unresolvedProperty, important, ruleType);
705 } 704 }
706 705
707 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper tyID unresolvedProperty, bool important, StyleRule::Type ruleType) 706 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper tyID unresolvedProperty, bool important, StyleRule::Type ruleType)
708 { 707 {
709 CSSParserValueList valueList(range); 708 CSSPropertyParser::parseValue(unresolvedProperty, important, range, m_contex t, m_parsedProperties, ruleType);
710 if (!valueList.size())
711 return; // Parser error
712 CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, m_c ontext, m_parsedProperties, ruleType);
713 } 709 }
714 710
715 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR ange range) 711 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR ange range)
716 { 712 {
717 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); 713 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>);
718 while (true) { 714 while (true) {
719 range.consumeWhitespace(); 715 range.consumeWhitespace();
720 const CSSParserToken& token = range.consumeIncludingWhitespace(); 716 const CSSParserToken& token = range.consumeIncludingWhitespace();
721 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke n.numericValue() <= 100) 717 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke n.numericValue() <= 100)
722 result->append(token.numericValue() / 100); 718 result->append(token.numericValue() / 100);
723 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr om")) 719 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr om"))
724 result->append(0); 720 result->append(0);
725 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to ")) 721 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to "))
726 result->append(1); 722 result->append(1);
727 else 723 else
728 return nullptr; // Parser error, invalid value in keyframe selector 724 return nullptr; // Parser error, invalid value in keyframe selector
729 if (range.atEnd()) 725 if (range.atEnd())
730 return result.release(); 726 return result.release();
731 if (range.consume().type() != CommaToken) 727 if (range.consume().type() != CommaToken)
732 return nullptr; // Parser error 728 return nullptr; // Parser error
733 } 729 }
734 } 730 }
735 731
736 } // namespace blink 732 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/css/parser/CSSParserToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698