OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |