Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied suggested changes. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 CSSValueID id = range.peek().id(); 3248 CSSValueID id = range.peek().id();
3249 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter 3249 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
3250 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart 3250 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart
3251 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) 3251 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight)
3252 return consumeIdent(range); 3252 return consumeIdent(range);
3253 return nullptr; 3253 return nullptr;
3254 } 3254 }
3255 3255
3256 static PassRefPtrWillBeRawPtr<CSSValue> consumeSelfPositionOverflowPosition(CSSP arserTokenRange& range) 3256 static PassRefPtrWillBeRawPtr<CSSValue> consumeSelfPositionOverflowPosition(CSSP arserTokenRange& range)
3257 { 3257 {
3258 if (identMatches<CSSValueAuto, CSSValueStretch, CSSValueBaseline, CSSValueLa stBaseline>(range.peek().id())) 3258 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase line, CSSValueLastBaseline>(range.peek().id()))
3259 return consumeIdent(range); 3259 return consumeIdent(range);
3260 3260
3261 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowPosition = consumeIdent<CSSVal ueUnsafe, CSSValueSafe>(range); 3261 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowPosition = consumeIdent<CSSVal ueUnsafe, CSSValueSafe>(range);
3262 RefPtrWillBeRawPtr<CSSPrimitiveValue> selfPosition = consumeSelfPositionKeyw ord(range); 3262 RefPtrWillBeRawPtr<CSSPrimitiveValue> selfPosition = consumeSelfPositionKeyw ord(range);
3263 if (!selfPosition) 3263 if (!selfPosition)
3264 return nullptr; 3264 return nullptr;
3265 if (!overflowPosition) 3265 if (!overflowPosition)
3266 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); 3266 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range);
3267 if (overflowPosition) 3267 if (overflowPosition)
3268 return CSSValuePair::create(selfPosition.release(), overflowPosition, CS SValuePair::DropIdenticalValues); 3268 return CSSValuePair::create(selfPosition.release(), overflowPosition, CS SValuePair::DropIdenticalValues);
3269 return selfPosition.release(); 3269 return selfPosition.release();
3270 } 3270 }
3271 3271
3272 static PassRefPtrWillBeRawPtr<CSSValue> consumeAlignItems(CSSParserTokenRange& r ange)
3273 {
3274 // align-items property does not allow the 'auto' value.
3275 if (identMatches<CSSValueAuto>(range.peek().id()))
3276 return nullptr;
3277 return consumeSelfPositionOverflowPosition(range);
3278 }
3279
3272 static PassRefPtrWillBeRawPtr<CSSValue> consumeJustifyItems(CSSParserTokenRange& range) 3280 static PassRefPtrWillBeRawPtr<CSSValue> consumeJustifyItems(CSSParserTokenRange& range)
3273 { 3281 {
3274 CSSParserTokenRange rangeCopy = range; 3282 CSSParserTokenRange rangeCopy = range;
3275 RefPtrWillBeRawPtr<CSSPrimitiveValue> legacy = consumeIdent<CSSValueLegacy>( rangeCopy); 3283 RefPtrWillBeRawPtr<CSSPrimitiveValue> legacy = consumeIdent<CSSValueLegacy>( rangeCopy);
3276 RefPtrWillBeRawPtr<CSSPrimitiveValue> positionKeyword = consumeIdent<CSSValu eCenter, CSSValueLeft, CSSValueRight>(rangeCopy); 3284 RefPtrWillBeRawPtr<CSSPrimitiveValue> positionKeyword = consumeIdent<CSSValu eCenter, CSSValueLeft, CSSValueRight>(rangeCopy);
3277 if (!legacy) 3285 if (!legacy)
3278 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); 3286 legacy = consumeIdent<CSSValueLegacy>(rangeCopy);
3279 if (legacy && positionKeyword) { 3287 if (legacy && positionKeyword) {
3280 range = rangeCopy; 3288 range = rangeCopy;
3281 return CSSValuePair::create(legacy.release(), positionKeyword.release(), CSSValuePair::DropIdenticalValues); 3289 return CSSValuePair::create(legacy.release(), positionKeyword.release(), CSSValuePair::DropIdenticalValues);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3630 case CSSPropertyWebkitMaskComposite: 3638 case CSSPropertyWebkitMaskComposite:
3631 case CSSPropertyWebkitMaskImage: 3639 case CSSPropertyWebkitMaskImage:
3632 case CSSPropertyWebkitMaskOrigin: 3640 case CSSPropertyWebkitMaskOrigin:
3633 case CSSPropertyWebkitMaskPositionX: 3641 case CSSPropertyWebkitMaskPositionX:
3634 case CSSPropertyWebkitMaskPositionY: 3642 case CSSPropertyWebkitMaskPositionY:
3635 case CSSPropertyWebkitMaskSize: 3643 case CSSPropertyWebkitMaskSize:
3636 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra nge, m_context); 3644 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, m_ra nge, m_context);
3637 case CSSPropertyWebkitMaskRepeatX: 3645 case CSSPropertyWebkitMaskRepeatX:
3638 case CSSPropertyWebkitMaskRepeatY: 3646 case CSSPropertyWebkitMaskRepeatY:
3639 return nullptr; 3647 return nullptr;
3648 case CSSPropertyAlignItems:
3649 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3650 return consumeAlignItems(m_range);
3640 case CSSPropertyJustifySelf: 3651 case CSSPropertyJustifySelf:
3641 case CSSPropertyAlignSelf: 3652 case CSSPropertyAlignSelf:
3642 case CSSPropertyAlignItems:
3643 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3653 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3644 return consumeSelfPositionOverflowPosition(m_range); 3654 return consumeSelfPositionOverflowPosition(m_range);
3645 case CSSPropertyJustifyItems: 3655 case CSSPropertyJustifyItems:
3646 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3656 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3647 return consumeJustifyItems(m_range); 3657 return consumeJustifyItems(m_range);
3648 default: 3658 default:
3649 CSSParserValueList valueList(m_range); 3659 CSSParserValueList valueList(m_range);
3650 if (valueList.size()) { 3660 if (valueList.size()) {
3651 m_valueList = &valueList; 3661 m_valueList = &valueList;
3652 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { 3662 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) {
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
4581 m_currentShorthand = oldShorthand; 4591 m_currentShorthand = oldShorthand;
4582 CSSParserValueList valueList(m_range); 4592 CSSParserValueList valueList(m_range);
4583 if (!valueList.size()) 4593 if (!valueList.size())
4584 return false; 4594 return false;
4585 m_valueList = &valueList; 4595 m_valueList = &valueList;
4586 return legacyParseShorthand(unresolvedProperty, important); 4596 return legacyParseShorthand(unresolvedProperty, important);
4587 } 4597 }
4588 } 4598 }
4589 4599
4590 } // namespace blink 4600 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698