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

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 333423005: [CSS Grid Layout] Implement 'justify-items' parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index e6a9a176492a63858ccf2da9e95363fca5489e67..62ae9f4b38e97fc9d680a2f462683da171916601 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1197,6 +1197,15 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
return false;
return parseItemPositionOverflowPosition(propId, important);
+ case CSSPropertyJustifyItems:
+ if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
+ return false;
+
+ if (parseLegacyPosition(propId, important))
+ return true;
+
+ m_valueList->setCurrentIndex(0);
+ return parseItemPositionOverflowPosition(propId, important);
case CSSPropertyGridAutoFlow:
if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
return false;
@@ -4180,6 +4189,11 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeInset(CS
return shape;
}
+static bool isBaselinePositionKeyword(CSSValueID id)
+{
+ return id == CSSValueBaseline || id == CSSValueLastBaseline;
+}
+
static bool isItemPositionKeyword(CSSValueID id)
{
return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
@@ -4187,15 +4201,43 @@ static bool isItemPositionKeyword(CSSValueID id)
|| id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight;
}
+bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important)
+{
+ // [ legacy && [ left | right | center ]
+
+ CSSParserValue* value = m_valueList->current();
+ if (!value)
+ return false;
+
+ if (value->id == CSSValueLegacy) {
+ value = m_valueList->next();
+ if (!value)
+ return false;
+ if (value->id != CSSValueCenter && value->id != CSSValueLeft && value->id != CSSValueRight)
+ return false;
+ } else if (value->id == CSSValueCenter || value->id == CSSValueLeft || value->id == CSSValueRight) {
+ if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy)
+ return false;
+ } else {
+ return false;
+ }
+
+ addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifierValue(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), important);
+ return !m_valueList->next();
+}
+
bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important)
{
- // auto | baseline | stretch | [<item-position> && <overflow-position>? ]
+ // auto | stretch | <baseline-position> | [<item-position> && <overflow-position>? ]
+ // <baseline-position> = baseline | last-baseline;
// <item-position> = center | start | end | self-start | self-end | flex-start | flex-end | left | right;
// <overflow-position> = true | safe
CSSParserValue* value = m_valueList->current();
+ if (!value)
+ return false;
- if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) {
+ if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselinePositionKeyword(value->id)) {
if (m_valueList->next())
return false;

Powered by Google App Engine
This is Rietveld 408576698