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

Unified Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing v3 Created 5 years, 2 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: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 36a928edc5b68376f7e4e5711e2774dee99ba3d3..3f6f65b003d6853c862f2aa7631da0534618de24 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -1172,6 +1172,16 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
parsedValue = parseGridPosition();
break;
+ case CSSPropertyGridColumnGap:
+ case CSSPropertyGridRowGap:
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ validPrimitive = validUnit(value, FLength | FNonNeg);
rune 2015/10/05 12:23:39 The current spec draft doesn't say it's limited to
svillar 2015/10/05 12:36:01 True, I think it's just an overlook, actually the
rune 2015/10/05 12:47:10 Yes, I just wanted to make sure the spec issue is
+ break;
+
+ case CSSPropertyGridGap:
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ return parseGridGapShorthand(important);
+
case CSSPropertyGridColumn:
case CSSPropertyGridRow:
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -3197,6 +3207,49 @@ bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
return true;
}
+bool CSSPropertyParser::parseGridGapShorthand(bool important)
fs 2015/10/05 10:53:28 Could you use parseShorthand instead?
svillar 2015/10/05 11:58:40 I don't think so because although ideally the shor
fs 2015/10/05 12:01:54 Right, I figured it might be the column-gap -> row
+{
+ ShorthandScope scope(this, CSSPropertyGridGap);
+ ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
+
+ CSSParserValue* value = m_valueList->current();
+ if (!value)
+ return false;
+
+ if (value->id == CSSValueNormal) {
+ if (m_valueList->next())
+ return false;
+ addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitInitialValue(), important);
rune 2015/10/05 12:23:39 According to the spec, "normal" is not a valid val
svillar 2015/10/05 12:36:01 That was specified in the previous draft, see http
rune 2015/10/05 12:47:10 Ah. So the property used to be shared with multico
+ addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialValue(), important);
+ return true;
+ }
+
+ if (!validUnit(value, FLength | FNonNeg))
+ return false;
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = createPrimitiveNumericValue(value);
+
+ value = m_valueList->next();
+ if (!value) {
+ addProperty(CSSPropertyGridColumnGap, columnGap, important);
+ addProperty(CSSPropertyGridRowGap, columnGap, important);
rune 2015/10/05 12:23:39 I think it this code might be easier to read if yo
svillar 2015/10/05 12:36:01 Acknowledged.
+ return true;
+ }
+
+ if (!validUnit(value, FLength | FNonNeg))
+ return false;
+
+ if (m_valueList->next())
+ return false;
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = createPrimitiveNumericValue(value);
+
+ addProperty(CSSPropertyGridColumnGap, columnGap, important);
+ addProperty(CSSPropertyGridRowGap, rowGap, important);
+
+ return true;
+}
+
bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSSValue> templateColumns, bool important)
{
NamedGridAreaMap gridAreaMap;

Powered by Google App Engine
This is Rietveld 408576698