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 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2671 CSSValueID id = range.peek().id(); | 2671 CSSValueID id = range.peek().id(); |
2672 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 2672 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
2673 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 2673 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
2674 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) | 2674 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) |
2675 return consumeIdent(range); | 2675 return consumeIdent(range); |
2676 return nullptr; | 2676 return nullptr; |
2677 } | 2677 } |
2678 | 2678 |
2679 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) | 2679 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) |
2680 { | 2680 { |
2681 if (identMatches<CSSValueAuto, CSSValueStretch, CSSValueBaseline, CSSValueLa
stBaseline>(range.peek().id())) | 2681 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase
line, CSSValueLastBaseline>(range.peek().id())) |
2682 return consumeIdent(range); | 2682 return consumeIdent(range); |
2683 | 2683 |
2684 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); | 2684 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); |
2685 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); | 2685 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); |
2686 if (!selfPosition) | 2686 if (!selfPosition) |
2687 return nullptr; | 2687 return nullptr; |
2688 if (!overflowPosition) | 2688 if (!overflowPosition) |
2689 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); | 2689 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); |
2690 if (overflowPosition) | 2690 if (overflowPosition) |
2691 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); | 2691 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); |
2692 return selfPosition; | 2692 return selfPosition; |
2693 } | 2693 } |
2694 | 2694 |
| 2695 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) |
| 2696 { |
| 2697 // align-items property does not allow the 'auto' value. |
| 2698 if (identMatches<CSSValueAuto>(range.peek().id())) |
| 2699 return nullptr; |
| 2700 return consumeSelfPositionOverflowPosition(range); |
| 2701 } |
| 2702 |
2695 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) | 2703 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) |
2696 { | 2704 { |
2697 CSSParserTokenRange rangeCopy = range; | 2705 CSSParserTokenRange rangeCopy = range; |
2698 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2706 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
2699 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); | 2707 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); |
2700 if (!legacy) | 2708 if (!legacy) |
2701 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2709 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
2702 if (legacy && positionKeyword) { | 2710 if (legacy && positionKeyword) { |
2703 range = rangeCopy; | 2711 range = rangeCopy; |
2704 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); | 2712 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 case CSSPropertyWebkitMaskComposite: | 3452 case CSSPropertyWebkitMaskComposite: |
3445 case CSSPropertyWebkitMaskImage: | 3453 case CSSPropertyWebkitMaskImage: |
3446 case CSSPropertyWebkitMaskOrigin: | 3454 case CSSPropertyWebkitMaskOrigin: |
3447 case CSSPropertyWebkitMaskPositionX: | 3455 case CSSPropertyWebkitMaskPositionX: |
3448 case CSSPropertyWebkitMaskPositionY: | 3456 case CSSPropertyWebkitMaskPositionY: |
3449 case CSSPropertyWebkitMaskSize: | 3457 case CSSPropertyWebkitMaskSize: |
3450 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); | 3458 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra
nge, m_context); |
3451 case CSSPropertyWebkitMaskRepeatX: | 3459 case CSSPropertyWebkitMaskRepeatX: |
3452 case CSSPropertyWebkitMaskRepeatY: | 3460 case CSSPropertyWebkitMaskRepeatY: |
3453 return nullptr; | 3461 return nullptr; |
| 3462 case CSSPropertyAlignItems: |
| 3463 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3464 return consumeAlignItems(m_range); |
3454 case CSSPropertyJustifySelf: | 3465 case CSSPropertyJustifySelf: |
3455 case CSSPropertyAlignSelf: | 3466 case CSSPropertyAlignSelf: |
3456 case CSSPropertyAlignItems: | |
3457 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3467 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3458 return consumeSelfPositionOverflowPosition(m_range); | 3468 return consumeSelfPositionOverflowPosition(m_range); |
3459 case CSSPropertyJustifyItems: | 3469 case CSSPropertyJustifyItems: |
3460 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3470 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3461 return consumeJustifyItems(m_range); | 3471 return consumeJustifyItems(m_range); |
3462 case CSSPropertyGridColumnEnd: | 3472 case CSSPropertyGridColumnEnd: |
3463 case CSSPropertyGridColumnStart: | 3473 case CSSPropertyGridColumnStart: |
3464 case CSSPropertyGridRowEnd: | 3474 case CSSPropertyGridRowEnd: |
3465 case CSSPropertyGridRowStart: | 3475 case CSSPropertyGridRowStart: |
3466 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3476 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 case CSSPropertyGridTemplate: | 4699 case CSSPropertyGridTemplate: |
4690 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4700 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4691 case CSSPropertyGrid: | 4701 case CSSPropertyGrid: |
4692 return consumeGridShorthand(important); | 4702 return consumeGridShorthand(important); |
4693 default: | 4703 default: |
4694 return false; | 4704 return false; |
4695 } | 4705 } |
4696 } | 4706 } |
4697 | 4707 |
4698 } // namespace blink | 4708 } // namespace blink |
OLD | NEW |