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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp

Issue 2056593005: Move more helper methods out of CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 6 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 "core/css/parser/CSSParserFastPaths.h" 5 #include "core/css/parser/CSSParserFastPaths.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSColorValue.h" 8 #include "core/css/CSSColorValue.h"
9 #include "core/css/CSSFunctionValue.h" 9 #include "core/css/CSSFunctionValue.h"
10 #include "core/css/CSSInheritedValue.h" 10 #include "core/css/CSSInheritedValue.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } else if (length > 1 && characters[length - 1] == '%') { 79 } else if (length > 1 && characters[length - 1] == '%') {
80 length -= 1; 80 length -= 1;
81 unit = CSSPrimitiveValue::UnitType::Percentage; 81 unit = CSSPrimitiveValue::UnitType::Percentage;
82 } 82 }
83 83
84 // We rely on charactersToDouble for validation as well. The function 84 // We rely on charactersToDouble for validation as well. The function
85 // will set "ok" to "false" if the entire passed-in character range does 85 // will set "ok" to "false" if the entire passed-in character range does
86 // not represent a double. 86 // not represent a double.
87 bool ok; 87 bool ok;
88 number = charactersToDouble(characters, length, &ok); 88 number = charactersToDouble(characters, length, &ok);
89 return ok && CSSPropertyParser::isValidNumericValue(number); 89 return ok && CSSParserToken::isValidNumericValue(number);
90 } 90 }
91 91
92 static CSSValue* parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode) 92 static CSSValue* parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
93 { 93 {
94 ASSERT(!string.isEmpty()); 94 ASSERT(!string.isEmpty());
95 bool acceptsNegativeNumbers = false; 95 bool acceptsNegativeNumbers = false;
96 96
97 // In @viewport, width and height are shorthands, not simple length values. 97 // In @viewport, width and height are shorthands, not simple length values.
98 if (isCSSViewportParsingEnabledForMode(cssParserMode) || !isSimpleLengthProp ertyID(propertyId, acceptsNegativeNumbers)) 98 if (isCSSViewportParsingEnabledForMode(cssParserMode) || !isSimpleLengthProp ertyID(propertyId, acceptsNegativeNumbers))
99 return nullptr; 99 return nullptr;
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 if (isColorPropertyID(propertyID)) 1074 if (isColorPropertyID(propertyID))
1075 return parseColor(string, parserMode); 1075 return parseColor(string, parserMode);
1076 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) 1076 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
1077 return keyword; 1077 return keyword;
1078 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) 1078 if (CSSValue* transform = parseSimpleTransform(propertyID, string))
1079 return transform; 1079 return transform;
1080 return nullptr; 1080 return nullptr;
1081 } 1081 }
1082 1082
1083 } // namespace blink 1083 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParser.cpp ('k') | third_party/WebKit/Source/core/css/parser/CSSParserToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698