OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
8 #include "core/css/CSSBasicShapeValues.h" | 8 #include "core/css/CSSBasicShapeValues.h" |
9 #include "core/css/CSSBorderImage.h" | 9 #include "core/css/CSSBorderImage.h" |
10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 CSSValueID id = range.peek().id(); | 3077 CSSValueID id = range.peek().id(); |
3078 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 3078 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
3079 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 3079 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
3080 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) | 3080 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) |
3081 return consumeIdent(range); | 3081 return consumeIdent(range); |
3082 return nullptr; | 3082 return nullptr; |
3083 } | 3083 } |
3084 | 3084 |
3085 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) | 3085 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) |
3086 { | 3086 { |
3087 if (identMatches<CSSValueAuto, CSSValueStretch, CSSValueBaseline, CSSValueLa
stBaseline>(range.peek().id())) | 3087 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase
line, CSSValueLastBaseline>(range.peek().id())) |
3088 return consumeIdent(range); | 3088 return consumeIdent(range); |
3089 | 3089 |
3090 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); | 3090 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); |
3091 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); | 3091 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); |
3092 if (!selfPosition) | 3092 if (!selfPosition) |
3093 return nullptr; | 3093 return nullptr; |
3094 if (!overflowPosition) | 3094 if (!overflowPosition) |
3095 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); | 3095 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); |
3096 if (overflowPosition) | 3096 if (overflowPosition) |
3097 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); | 3097 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); |
3098 return selfPosition; | 3098 return selfPosition; |
3099 } | 3099 } |
3100 | 3100 |
| 3101 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) |
| 3102 { |
| 3103 // align-items property does not allow the 'auto' value. |
| 3104 if (identMatches<CSSValueAuto>(range.peek().id())) |
| 3105 return nullptr; |
| 3106 return consumeSelfPositionOverflowPosition(range); |
| 3107 } |
| 3108 |
3101 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) | 3109 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) |
3102 { | 3110 { |
3103 CSSParserTokenRange rangeCopy = range; | 3111 CSSParserTokenRange rangeCopy = range; |
3104 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 3112 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
3105 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); | 3113 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); |
3106 if (!legacy) | 3114 if (!legacy) |
3107 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 3115 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
3108 if (legacy && positionKeyword) { | 3116 if (legacy && positionKeyword) { |
3109 range = rangeCopy; | 3117 range = rangeCopy; |
3110 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); | 3118 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3803 case CSSPropertyWebkitMaskComposite: | 3811 case CSSPropertyWebkitMaskComposite: |
3804 case CSSPropertyWebkitMaskImage: | 3812 case CSSPropertyWebkitMaskImage: |
3805 case CSSPropertyWebkitMaskOrigin: | 3813 case CSSPropertyWebkitMaskOrigin: |
3806 case CSSPropertyWebkitMaskPositionX: | 3814 case CSSPropertyWebkitMaskPositionX: |
3807 case CSSPropertyWebkitMaskPositionY: | 3815 case CSSPropertyWebkitMaskPositionY: |
3808 case CSSPropertyWebkitMaskSize: | 3816 case CSSPropertyWebkitMaskSize: |
3809 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); | 3817 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); |
3810 case CSSPropertyWebkitMaskRepeatX: | 3818 case CSSPropertyWebkitMaskRepeatX: |
3811 case CSSPropertyWebkitMaskRepeatY: | 3819 case CSSPropertyWebkitMaskRepeatY: |
3812 return nullptr; | 3820 return nullptr; |
| 3821 case CSSPropertyAlignItems: |
| 3822 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3823 return consumeAlignItems(m_range); |
3813 case CSSPropertyJustifySelf: | 3824 case CSSPropertyJustifySelf: |
3814 case CSSPropertyAlignSelf: | 3825 case CSSPropertyAlignSelf: |
3815 case CSSPropertyAlignItems: | |
3816 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3826 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3817 return consumeSelfPositionOverflowPosition(m_range); | 3827 return consumeSelfPositionOverflowPosition(m_range); |
3818 case CSSPropertyJustifyItems: | 3828 case CSSPropertyJustifyItems: |
3819 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3829 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3820 return consumeJustifyItems(m_range); | 3830 return consumeJustifyItems(m_range); |
3821 case CSSPropertyGridColumnEnd: | 3831 case CSSPropertyGridColumnEnd: |
3822 case CSSPropertyGridColumnStart: | 3832 case CSSPropertyGridColumnStart: |
3823 case CSSPropertyGridRowEnd: | 3833 case CSSPropertyGridRowEnd: |
3824 case CSSPropertyGridRowStart: | 3834 case CSSPropertyGridRowStart: |
3825 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3835 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5033 case CSSPropertyGridTemplate: | 5043 case CSSPropertyGridTemplate: |
5034 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5044 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
5035 case CSSPropertyGrid: | 5045 case CSSPropertyGrid: |
5036 return consumeGridShorthand(important); | 5046 return consumeGridShorthand(important); |
5037 default: | 5047 default: |
5038 return false; | 5048 return false; |
5039 } | 5049 } |
5040 } | 5050 } |
5041 | 5051 |
5042 } // namespace blink | 5052 } // namespace blink |
OLD | NEW |