| 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" |
| 11 #include "core/css/CSSInitialValue.h" | 11 #include "core/css/CSSInitialValue.h" |
| 12 #include "core/css/CSSPrimitiveValue.h" | 12 #include "core/css/CSSPrimitiveValue.h" |
| 13 #include "core/css/StyleColor.h" |
| 13 #include "core/css/parser/CSSParserIdioms.h" | 14 #include "core/css/parser/CSSParserIdioms.h" |
| 14 #include "core/css/parser/CSSPropertyParser.h" | 15 #include "core/css/parser/CSSPropertyParser.h" |
| 15 #include "core/html/parser/HTMLParserIdioms.h" | 16 #include "core/html/parser/HTMLParserIdioms.h" |
| 16 #include "platform/RuntimeEnabledFeatures.h" | 17 #include "platform/RuntimeEnabledFeatures.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acce
ptsNegativeNumbers) | 21 static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acce
ptsNegativeNumbers) |
| 21 { | 22 { |
| 22 switch (propertyId) { | 23 switch (propertyId) { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 return true; | 437 return true; |
| 437 } | 438 } |
| 438 | 439 |
| 439 return false; | 440 return false; |
| 440 } | 441 } |
| 441 | 442 |
| 442 CSSValue* CSSParserFastPaths::parseColor(const String& string, CSSParserMode par
serMode) | 443 CSSValue* CSSParserFastPaths::parseColor(const String& string, CSSParserMode par
serMode) |
| 443 { | 444 { |
| 444 ASSERT(!string.isEmpty()); | 445 ASSERT(!string.isEmpty()); |
| 445 CSSValueID valueID = cssValueKeywordID(string); | 446 CSSValueID valueID = cssValueKeywordID(string); |
| 446 if (CSSPropertyParser::isColorKeyword(valueID)) { | 447 if (StyleColor::isColorKeyword(valueID)) { |
| 447 if (!isValueAllowedInMode(valueID, parserMode)) | 448 if (!isValueAllowedInMode(valueID, parserMode)) |
| 448 return nullptr; | 449 return nullptr; |
| 449 return CSSPrimitiveValue::createIdentifier(valueID); | 450 return CSSPrimitiveValue::createIdentifier(valueID); |
| 450 } | 451 } |
| 451 | 452 |
| 452 RGBA32 color; | 453 RGBA32 color; |
| 453 bool quirksMode = isQuirksModeBehavior(parserMode); | 454 bool quirksMode = isQuirksModeBehavior(parserMode); |
| 454 | 455 |
| 455 // Fast path for hex colors and rgb()/rgba() colors | 456 // Fast path for hex colors and rgb()/rgba() colors |
| 456 bool parseResult; | 457 bool parseResult; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 if (isColorPropertyID(propertyID)) | 1074 if (isColorPropertyID(propertyID)) |
| 1074 return parseColor(string, parserMode); | 1075 return parseColor(string, parserMode); |
| 1075 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) | 1076 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) |
| 1076 return keyword; | 1077 return keyword; |
| 1077 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) | 1078 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) |
| 1078 return transform; | 1079 return transform; |
| 1079 return nullptr; | 1080 return nullptr; |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 } // namespace blink | 1083 } // namespace blink |
| OLD | NEW |