| 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 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 CSSValueID id = range.peek().id(); | 3168 CSSValueID id = range.peek().id(); |
| 3169 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 3169 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 3170 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 3170 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
| 3171 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) | 3171 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) |
| 3172 return consumeIdent(range); | 3172 return consumeIdent(range); |
| 3173 return nullptr; | 3173 return nullptr; |
| 3174 } | 3174 } |
| 3175 | 3175 |
| 3176 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) | 3176 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) |
| 3177 { | 3177 { |
| 3178 if (identMatches<CSSValueAuto, CSSValueStretch, CSSValueBaseline, CSSValueLa
stBaseline>(range.peek().id())) | 3178 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase
line, CSSValueLastBaseline>(range.peek().id())) |
| 3179 return consumeIdent(range); | 3179 return consumeIdent(range); |
| 3180 | 3180 |
| 3181 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); | 3181 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); |
| 3182 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); | 3182 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); |
| 3183 if (!selfPosition) | 3183 if (!selfPosition) |
| 3184 return nullptr; | 3184 return nullptr; |
| 3185 if (!overflowPosition) | 3185 if (!overflowPosition) |
| 3186 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); | 3186 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); |
| 3187 if (overflowPosition) | 3187 if (overflowPosition) |
| 3188 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); | 3188 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); |
| 3189 return selfPosition; | 3189 return selfPosition; |
| 3190 } | 3190 } |
| 3191 | 3191 |
| 3192 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) |
| 3193 { |
| 3194 // align-items property does not allow the 'auto' value. |
| 3195 if (identMatches<CSSValueAuto>(range.peek().id())) |
| 3196 return nullptr; |
| 3197 return consumeSelfPositionOverflowPosition(range); |
| 3198 } |
| 3199 |
| 3192 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) | 3200 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) |
| 3193 { | 3201 { |
| 3194 CSSParserTokenRange rangeCopy = range; | 3202 CSSParserTokenRange rangeCopy = range; |
| 3195 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 3203 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
| 3196 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); | 3204 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); |
| 3197 if (!legacy) | 3205 if (!legacy) |
| 3198 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 3206 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
| 3199 if (legacy && positionKeyword) { | 3207 if (legacy && positionKeyword) { |
| 3200 range = rangeCopy; | 3208 range = rangeCopy; |
| 3201 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); | 3209 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3930 case CSSPropertyWebkitMaskComposite: | 3938 case CSSPropertyWebkitMaskComposite: |
| 3931 case CSSPropertyWebkitMaskImage: | 3939 case CSSPropertyWebkitMaskImage: |
| 3932 case CSSPropertyWebkitMaskOrigin: | 3940 case CSSPropertyWebkitMaskOrigin: |
| 3933 case CSSPropertyWebkitMaskPositionX: | 3941 case CSSPropertyWebkitMaskPositionX: |
| 3934 case CSSPropertyWebkitMaskPositionY: | 3942 case CSSPropertyWebkitMaskPositionY: |
| 3935 case CSSPropertyWebkitMaskSize: | 3943 case CSSPropertyWebkitMaskSize: |
| 3936 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); | 3944 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); |
| 3937 case CSSPropertyWebkitMaskRepeatX: | 3945 case CSSPropertyWebkitMaskRepeatX: |
| 3938 case CSSPropertyWebkitMaskRepeatY: | 3946 case CSSPropertyWebkitMaskRepeatY: |
| 3939 return nullptr; | 3947 return nullptr; |
| 3948 case CSSPropertyAlignItems: |
| 3949 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3950 return consumeAlignItems(m_range); |
| 3940 case CSSPropertyJustifySelf: | 3951 case CSSPropertyJustifySelf: |
| 3941 case CSSPropertyAlignSelf: | 3952 case CSSPropertyAlignSelf: |
| 3942 case CSSPropertyAlignItems: | |
| 3943 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3953 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3944 return consumeSelfPositionOverflowPosition(m_range); | 3954 return consumeSelfPositionOverflowPosition(m_range); |
| 3945 case CSSPropertyJustifyItems: | 3955 case CSSPropertyJustifyItems: |
| 3946 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3956 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3947 return consumeJustifyItems(m_range); | 3957 return consumeJustifyItems(m_range); |
| 3948 case CSSPropertyGridColumnEnd: | 3958 case CSSPropertyGridColumnEnd: |
| 3949 case CSSPropertyGridColumnStart: | 3959 case CSSPropertyGridColumnStart: |
| 3950 case CSSPropertyGridRowEnd: | 3960 case CSSPropertyGridRowEnd: |
| 3951 case CSSPropertyGridRowStart: | 3961 case CSSPropertyGridRowStart: |
| 3952 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3962 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5168 case CSSPropertyGridTemplate: | 5178 case CSSPropertyGridTemplate: |
| 5169 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5179 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
| 5170 case CSSPropertyGrid: | 5180 case CSSPropertyGrid: |
| 5171 return consumeGridShorthand(important); | 5181 return consumeGridShorthand(important); |
| 5172 default: | 5182 default: |
| 5173 return false; | 5183 return false; |
| 5174 } | 5184 } |
| 5175 } | 5185 } |
| 5176 | 5186 |
| 5177 } // namespace blink | 5187 } // namespace blink |
| OLD | NEW |