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

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: Keep utility functions private and make consumeSimplifiedXXX public Created 3 years, 8 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 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 important); 3292 important);
3293 addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, *autoRowsValue, 3293 addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, *autoRowsValue,
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) {
3303 CSSValueID id = range.peek().id();
3304 if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>(
3305 id)) {
3306 return CSSContentDistributionValue::create(
3307 CSSValueInvalid, range.consumeIncludingWhitespace().id(),
3308 CSSValueInvalid);
3309 }
3310 if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround,
3311 CSSValueSpaceEvenly, CSSValueStretch>(id)) {
3312 return CSSContentDistributionValue::create(
3313 range.consumeIncludingWhitespace().id(), CSSValueInvalid,
3314 CSSValueInvalid);
3315 }
3316 if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter,
3317 CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft,
3318 CSSValueRight>(id)) {
3319 return CSSContentDistributionValue::create(
3320 CSSValueInvalid, range.consumeIncludingWhitespace().id(),
3321 CSSValueInvalid);
3322 }
3323 return nullptr;
3324 }
3325
3326 bool CSSPropertyParser::consumePlaceContentShorthand(bool important) { 3302 bool CSSPropertyParser::consumePlaceContentShorthand(bool important) {
3327 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3303 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3328 DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(), 3304 DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(),
3329 static_cast<unsigned>(2)); 3305 static_cast<unsigned>(2));
3330 3306
3331 CSSValue* alignContentValue = consumeSimplifiedContentPosition(m_range); 3307 CSSValue* alignContentValue =
3308 CSSPropertyAlignmentUtils::consumeSimplifiedContentPosition(m_range);
3332 if (!alignContentValue) 3309 if (!alignContentValue)
3333 return false; 3310 return false;
3334 CSSValue* justifyContentValue = 3311 CSSValue* justifyContentValue =
3335 m_range.atEnd() ? alignContentValue 3312 m_range.atEnd()
3336 : consumeSimplifiedContentPosition(m_range); 3313 ? alignContentValue
3314 : CSSPropertyAlignmentUtils::consumeSimplifiedContentPosition(
3315 m_range);
3337 if (!justifyContentValue) 3316 if (!justifyContentValue)
3338 return false; 3317 return false;
3339 if (!m_range.atEnd()) 3318 if (!m_range.atEnd())
3340 return false; 3319 return false;
3341 3320
3342 addProperty(CSSPropertyAlignContent, CSSPropertyPlaceContent, 3321 addProperty(CSSPropertyAlignContent, CSSPropertyPlaceContent,
3343 *alignContentValue, important); 3322 *alignContentValue, important);
3344 addProperty(CSSPropertyJustifyContent, CSSPropertyPlaceContent, 3323 addProperty(CSSPropertyJustifyContent, CSSPropertyPlaceContent,
3345 *justifyContentValue, important); 3324 *justifyContentValue, important);
3346 return true; 3325 return true;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 case CSSPropertyGrid: 3585 case CSSPropertyGrid:
3607 return consumeGridShorthand(important); 3586 return consumeGridShorthand(important);
3608 case CSSPropertyPlaceContent: 3587 case CSSPropertyPlaceContent:
3609 return consumePlaceContentShorthand(important); 3588 return consumePlaceContentShorthand(important);
3610 default: 3589 default:
3611 return false; 3590 return false;
3612 } 3591 }
3613 } 3592 }
3614 3593
3615 } // namespace blink 3594 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698