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/CSSFunctionValue.h" | 8 #include "core/css/CSSFunctionValue.h" |
9 #include "core/css/CSSValuePool.h" | 9 #include "core/css/CSSValuePool.h" |
10 #include "core/css/parser/CSSParserIdioms.h" | 10 #include "core/css/parser/CSSParserIdioms.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // auto | use-script | no-change | reset-size | ideographic | | 521 // auto | use-script | no-change | reset-size | ideographic | |
522 // alphabetic | hanging | mathematical | central | middle | | 522 // alphabetic | hanging | mathematical | central | middle | |
523 // text-after-edge | text-before-edge | 523 // text-after-edge | text-before-edge |
524 return valueID == CSSValueAuto || valueID == CSSValueMiddle | 524 return valueID == CSSValueAuto || valueID == CSSValueMiddle |
525 || (valueID >= CSSValueUseScript && valueID <= CSSValueResetSize) | 525 || (valueID >= CSSValueUseScript && valueID <= CSSValueResetSize) |
526 || (valueID >= CSSValueCentral && valueID <= CSSValueMathematical); | 526 || (valueID >= CSSValueCentral && valueID <= CSSValueMathematical); |
527 case CSSPropertyEmptyCells: // show | hide | 527 case CSSPropertyEmptyCells: // show | hide |
528 return valueID == CSSValueShow || valueID == CSSValueHide; | 528 return valueID == CSSValueShow || valueID == CSSValueHide; |
529 case CSSPropertyFloat: // left | right | none | 529 case CSSPropertyFloat: // left | right | none |
530 return valueID == CSSValueLeft || valueID == CSSValueRight || valueID ==
CSSValueNone; | 530 return valueID == CSSValueLeft || valueID == CSSValueRight || valueID ==
CSSValueNone; |
531 case CSSPropertyFontDisplay: // auto | block | swap | fallback | optional | |
532 return valueID == CSSValueAuto || valueID == CSSValueBlock || valueID ==
CSSValueSwap || valueID == CSSValueFallback || valueID == CSSValueOptional; | |
533 case CSSPropertyFontStyle: // normal | italic | oblique | 531 case CSSPropertyFontStyle: // normal | italic | oblique |
534 return valueID == CSSValueNormal || valueID == CSSValueItalic || valueID
== CSSValueOblique; | 532 return valueID == CSSValueNormal || valueID == CSSValueItalic || valueID
== CSSValueOblique; |
535 case CSSPropertyFontStretch: // normal | ultra-condensed | extra-condensed |
condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-
expanded | 533 case CSSPropertyFontStretch: // normal | ultra-condensed | extra-condensed |
condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-
expanded |
536 return valueID == CSSValueNormal || (valueID >= CSSValueUltraCondensed &
& valueID <= CSSValueUltraExpanded); | 534 return valueID == CSSValueNormal || (valueID >= CSSValueUltraCondensed &
& valueID <= CSSValueUltraExpanded); |
537 case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated | 535 case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated |
538 return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContr
ast || (RuntimeEnabledFeatures::imageRenderingPixelatedEnabled() && valueID == C
SSValuePixelated); | 536 return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContr
ast || (RuntimeEnabledFeatures::imageRenderingPixelatedEnabled() && valueID == C
SSValuePixelated); |
539 case CSSPropertyIsolation: // auto | isolate | 537 case CSSPropertyIsolation: // auto | isolate |
540 return valueID == CSSValueAuto || valueID == CSSValueIsolate; | 538 return valueID == CSSValueAuto || valueID == CSSValueIsolate; |
541 case CSSPropertyListStylePosition: // inside | outside | 539 case CSSPropertyListStylePosition: // inside | outside |
542 return valueID == CSSValueInside || valueID == CSSValueOutside; | 540 return valueID == CSSValueInside || valueID == CSSValueOutside; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 ASSERT(!string.isEmpty()); | 833 ASSERT(!string.isEmpty()); |
836 | 834 |
837 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) { | 835 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) { |
838 // All properties accept the values of "initial" and "inherit". | 836 // All properties accept the values of "initial" and "inherit". |
839 if (!equalIgnoringASCIICase(string, "initial") && !equalIgnoringASCIICas
e(string, "inherit")) | 837 if (!equalIgnoringASCIICase(string, "initial") && !equalIgnoringASCIICas
e(string, "inherit")) |
840 return nullptr; | 838 return nullptr; |
841 | 839 |
842 // Parse initial/inherit shorthands using the CSSPropertyParser. | 840 // Parse initial/inherit shorthands using the CSSPropertyParser. |
843 if (shorthandForProperty(propertyId).length()) | 841 if (shorthandForProperty(propertyId).length()) |
844 return nullptr; | 842 return nullptr; |
| 843 |
| 844 // Descriptors do not support css wide keywords. |
| 845 if (CSSPropertyMetadata::isDescriptorOnly(propertyId)) |
| 846 return nullptr; |
845 } | 847 } |
846 | 848 |
847 CSSParserString cssString; | 849 CSSParserString cssString; |
848 cssString.init(string); | 850 cssString.init(string); |
849 CSSValueID valueID = cssValueKeywordID(cssString); | 851 CSSValueID valueID = cssValueKeywordID(cssString); |
850 | 852 |
851 if (!valueID) | 853 if (!valueID) |
852 return nullptr; | 854 return nullptr; |
853 | 855 |
854 if (valueID == CSSValueInherit) | 856 if (valueID == CSSValueInherit) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 if (isColorPropertyID(propertyID)) | 1075 if (isColorPropertyID(propertyID)) |
1074 return parseColor(string, parserMode); | 1076 return parseColor(string, parserMode); |
1075 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) | 1077 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) |
1076 return keyword; | 1078 return keyword; |
1077 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) | 1079 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) |
1078 return transform; | 1080 return transform; |
1079 return nullptr; | 1081 return nullptr; |
1080 } | 1082 } |
1081 | 1083 |
1082 } // namespace blink | 1084 } // namespace blink |
OLD | NEW |