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

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

Issue 2762623002: [css-align] Adapt the place-content shorthand to the new baseline syntax (Closed)
Patch Set: Additional refactoring to deal with baseline value ID Created 3 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 <memory> 7 #include <memory>
8 #include "core/StylePropertyShorthand.h" 8 #include "core/StylePropertyShorthand.h"
9 #include "core/css/CSSBasicShapeValues.h" 9 #include "core/css/CSSBasicShapeValues.h"
10 #include "core/css/CSSBorderImage.h" 10 #include "core/css/CSSBorderImage.h"
(...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 important); 3294 important);
3295 addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid, 3295 addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid,
3296 *CSSInitialValue::create(), important); 3296 *CSSInitialValue::create(), important);
3297 addProperty(CSSPropertyGridRowGap, CSSPropertyGrid, 3297 addProperty(CSSPropertyGridRowGap, CSSPropertyGrid,
3298 *CSSInitialValue::create(), important); 3298 *CSSInitialValue::create(), important);
3299 return true; 3299 return true;
3300 } 3300 }
3301 3301
3302 static CSSValue* consumeSimplifiedContentPosition(CSSParserTokenRange& range) { 3302 static CSSValue* consumeSimplifiedContentPosition(CSSParserTokenRange& range) {
3303 CSSValueID id = range.peek().id(); 3303 CSSValueID id = range.peek().id();
3304 if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>( 3304 if (identMatches<CSSValueNormal>(id)) {
Bugs Nash 2017/03/29 02:01:01 should CSSValueLastBaseline be removed? it's not c
jfernandez 2017/03/29 10:43:10 Actually not. It's debatable whether we need a dif
3305 id)) {
3306 return CSSContentDistributionValue::create( 3305 return CSSContentDistributionValue::create(
3307 CSSValueInvalid, range.consumeIncludingWhitespace().id(), 3306 CSSValueInvalid, range.consumeIncludingWhitespace().id(),
3308 CSSValueInvalid); 3307 CSSValueInvalid);
3309 } 3308 }
3310 if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, 3309
3311 CSSValueSpaceEvenly, CSSValueStretch>(id)) { 3310 if (CSSPropertyAlignmentUtils::isBaselineKeyword(id)) {
3311 CSSValue* baseline =
3312 CSSPropertyAlignmentUtils::consumeBaselineKeyword(range);
Bugs Nash 2017/03/29 02:01:01 consumeBaselineKeyword doesn't consume whitespace,
jfernandez 2017/03/29 10:43:10 I'm not sure I understand this comment. consumeBas
Bugs Nash 2017/03/29 21:52:11 cool np
3313 if (!baseline)
3314 return nullptr;
3315 return CSSContentDistributionValue::create(
3316 CSSValueInvalid,
3317 CSSPropertyAlignmentUtils::getBaselineKeyword(*baseline),
3318 CSSValueInvalid);
3319 }
3320
3321 if (CSSPropertyAlignmentUtils::isContentDistributionKeyword(id)) {
3312 return CSSContentDistributionValue::create( 3322 return CSSContentDistributionValue::create(
3313 range.consumeIncludingWhitespace().id(), CSSValueInvalid, 3323 range.consumeIncludingWhitespace().id(), CSSValueInvalid,
3314 CSSValueInvalid); 3324 CSSValueInvalid);
3315 } 3325 }
3316 if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter, 3326 if (CSSPropertyAlignmentUtils::isContentPositionKeyword(id)) {
Bugs Nash 2017/03/29 02:01:01 this should be combined with the if block above th
jfernandez 2017/03/29 10:43:10 Done.
3317 CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft,
3318 CSSValueRight>(id)) {
3319 return CSSContentDistributionValue::create( 3327 return CSSContentDistributionValue::create(
3320 CSSValueInvalid, range.consumeIncludingWhitespace().id(), 3328 CSSValueInvalid, range.consumeIncludingWhitespace().id(),
3321 CSSValueInvalid); 3329 CSSValueInvalid);
3322 } 3330 }
3323 return nullptr; 3331 return nullptr;
3324 } 3332 }
3325 3333
3326 bool CSSPropertyParser::consumePlaceContentShorthand(bool important) { 3334 bool CSSPropertyParser::consumePlaceContentShorthand(bool important) {
3327 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3335 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3328 DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(), 3336 DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(),
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 case CSSPropertyGrid: 3614 case CSSPropertyGrid:
3607 return consumeGridShorthand(important); 3615 return consumeGridShorthand(important);
3608 case CSSPropertyPlaceContent: 3616 case CSSPropertyPlaceContent:
3609 return consumePlaceContentShorthand(important); 3617 return consumePlaceContentShorthand(important);
3610 default: 3618 default:
3611 return false; 3619 return false;
3612 } 3620 }
3613 } 3621 }
3614 3622
3615 } // namespace blink 3623 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698