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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 return nullptr; | 460 return nullptr; |
461 return cssValuePool().createColorValue(color); | 461 return cssValuePool().createColorValue(color); |
462 } | 462 } |
463 | 463 |
464 bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
, CSSValueID valueID) | 464 bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
, CSSValueID valueID) |
465 { | 465 { |
466 if (valueID == CSSValueInvalid) | 466 if (valueID == CSSValueInvalid) |
467 return false; | 467 return false; |
468 | 468 |
469 switch (propertyId) { | 469 switch (propertyId) { |
| 470 case CSSPropertyOnclickType: |
| 471 case CSSPropertyOnscrollType: |
| 472 case CSSPropertyOntouchstartType: |
| 473 case CSSPropertyOntouchendType: |
| 474 case CSSPropertyOntouchmoveType: |
| 475 return valueID == CSSValueSingle || valueID == CSSValueContinuous; |
| 476 case CSSPropertyOnclickVduration: |
| 477 case CSSPropertyOnscrollVduration: |
| 478 case CSSPropertyOntouchstartVduration: |
| 479 case CSSPropertyOntouchendVduration: |
| 480 case CSSPropertyOntouchmoveVduration: |
| 481 return valueID == CSSValueShort || valueID == CSSValueLong; |
470 case CSSPropertyAlignmentBaseline: | 482 case CSSPropertyAlignmentBaseline: |
471 // auto | baseline | before-edge | text-before-edge | middle | | 483 // auto | baseline | before-edge | text-before-edge | middle | |
472 // central | after-edge | text-after-edge | ideographic | alphabetic | | 484 // central | after-edge | text-after-edge | ideographic | alphabetic | |
473 // hanging | mathematical | 485 // hanging | mathematical |
474 return valueID == CSSValueAuto || valueID == CSSValueBaseline || valueID
== CSSValueMiddle | 486 return valueID == CSSValueAuto || valueID == CSSValueBaseline || valueID
== CSSValueMiddle |
475 || (valueID >= CSSValueBeforeEdge && valueID <= CSSValueMathematical
); | 487 || (valueID >= CSSValueBeforeEdge && valueID <= CSSValueMathematical
); |
476 case CSSPropertyAll: | 488 case CSSPropertyAll: |
477 return false; // Only accepts css-wide keywords | 489 return false; // Only accepts css-wide keywords |
478 case CSSPropertyBackgroundRepeatX: // repeat | no-repeat | 490 case CSSPropertyBackgroundRepeatX: // repeat | no-repeat |
479 case CSSPropertyBackgroundRepeatY: // repeat | no-repeat | 491 case CSSPropertyBackgroundRepeatY: // repeat | no-repeat |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 return valueID == CSSValueNone || valueID == CSSValueMandatory || valueI
D == CSSValueProximity; | 715 return valueID == CSSValueNone || valueID == CSSValueMandatory || valueI
D == CSSValueProximity; |
704 default: | 716 default: |
705 ASSERT_NOT_REACHED(); | 717 ASSERT_NOT_REACHED(); |
706 return false; | 718 return false; |
707 } | 719 } |
708 } | 720 } |
709 | 721 |
710 bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId) | 722 bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId) |
711 { | 723 { |
712 switch (propertyId) { | 724 switch (propertyId) { |
| 725 case CSSPropertyOnclickType: |
| 726 case CSSPropertyOnclickVduration: |
| 727 case CSSPropertyOnscrollType: |
| 728 case CSSPropertyOnscrollVduration: |
| 729 case CSSPropertyOntouchstartType: |
| 730 case CSSPropertyOntouchstartVduration: |
| 731 case CSSPropertyOntouchendType: |
| 732 case CSSPropertyOntouchendVduration: |
| 733 case CSSPropertyOntouchmoveType: |
| 734 case CSSPropertyOntouchmoveVduration: |
713 case CSSPropertyAlignmentBaseline: | 735 case CSSPropertyAlignmentBaseline: |
714 case CSSPropertyAll: | 736 case CSSPropertyAll: |
715 case CSSPropertyMixBlendMode: | 737 case CSSPropertyMixBlendMode: |
716 case CSSPropertyIsolation: | 738 case CSSPropertyIsolation: |
717 case CSSPropertyBackgroundRepeatX: | 739 case CSSPropertyBackgroundRepeatX: |
718 case CSSPropertyBackgroundRepeatY: | 740 case CSSPropertyBackgroundRepeatY: |
719 case CSSPropertyBorderBottomStyle: | 741 case CSSPropertyBorderBottomStyle: |
720 case CSSPropertyBorderCollapse: | 742 case CSSPropertyBorderCollapse: |
721 case CSSPropertyBorderLeftStyle: | 743 case CSSPropertyBorderLeftStyle: |
722 case CSSPropertyBorderRightStyle: | 744 case CSSPropertyBorderRightStyle: |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 if (isColorPropertyID(propertyID)) | 1045 if (isColorPropertyID(propertyID)) |
1024 return parseColor(string, parserMode); | 1046 return parseColor(string, parserMode); |
1025 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) | 1047 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) |
1026 return keyword.release(); | 1048 return keyword.release(); |
1027 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) | 1049 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) |
1028 return transform.release(); | 1050 return transform.release(); |
1029 return nullptr; | 1051 return nullptr; |
1030 } | 1052 } |
1031 | 1053 |
1032 } // namespace blink | 1054 } // namespace blink |
OLD | NEW |