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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSParserFastPaths.h" | 6 #include "core/css/parser/CSSParserFastPaths.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSFunctionValue.h" | 9 #include "core/css/CSSFunctionValue.h" |
10 #include "core/css/CSSValuePool.h" | 10 #include "core/css/CSSValuePool.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 return false; | 428 return false; |
429 } | 429 } |
430 | 430 |
431 PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::parseColor(const String& st
ring, bool quirksMode) | 431 PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::parseColor(const String& st
ring, bool quirksMode) |
432 { | 432 { |
433 ASSERT(!string.isEmpty()); | 433 ASSERT(!string.isEmpty()); |
434 CSSParserString cssString; | 434 CSSParserString cssString; |
435 cssString.init(string); | 435 cssString.init(string); |
436 CSSValueID valueID = cssValueKeywordID(cssString); | 436 CSSValueID valueID = cssValueKeywordID(cssString); |
437 if (valueID == CSSValueWebkitText || valueID == CSSValueCurrentcolor || valu
eID == CSSValueGrey | 437 if (valueID == CSSValueCurrentcolor || valueID == CSSValueGrey |
438 || (valueID >= CSSValueAqua && valueID <= CSSValueWindowtext) || valueID
== CSSValueMenu | 438 || (valueID >= CSSValueAqua && valueID <= CSSValueWindowtext) || valueID
== CSSValueMenu |
439 || (quirksMode && valueID >= CSSValueWebkitFocusRingColor && valueID < C
SSValueWebkitText)) | 439 || (quirksMode && valueID >= CSSValueWebkitFocusRingColor && valueID <=
CSSValueWebkitText)) |
440 return cssValuePool().createIdentifierValue(valueID); | 440 return cssValuePool().createIdentifierValue(valueID); |
441 | 441 |
442 RGBA32 color; | 442 RGBA32 color; |
443 | 443 |
444 // Fast path for hex colors and rgb()/rgba() colors | 444 // Fast path for hex colors and rgb()/rgba() colors |
445 bool parseResult; | 445 bool parseResult; |
446 if (string.is8Bit()) | 446 if (string.is8Bit()) |
447 parseResult = fastParseColorInternal(color, string.characters8(), string
.length(), quirksMode); | 447 parseResult = fastParseColorInternal(color, string.characters8(), string
.length(), quirksMode); |
448 else | 448 else |
449 parseResult = fastParseColorInternal(color, string.characters16(), strin
g.length(), quirksMode); | 449 parseResult = fastParseColorInternal(color, string.characters16(), strin
g.length(), quirksMode); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 if (isColorPropertyID(propertyID)) | 949 if (isColorPropertyID(propertyID)) |
950 return parseColor(string, isQuirksModeBehavior(parserMode)); | 950 return parseColor(string, isQuirksModeBehavior(parserMode)); |
951 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) | 951 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) |
952 return keyword.release(); | 952 return keyword.release(); |
953 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) | 953 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) |
954 return transform.release(); | 954 return transform.release(); |
955 return nullptr; | 955 return nullptr; |
956 } | 956 } |
957 | 957 |
958 } // namespace blink | 958 } // namespace blink |
OLD | NEW |