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

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

Issue 2287113004: [css-grid] Implement fit-content track size (Closed)
Patch Set: Created 4 years, 4 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/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 049f9129408633b4b841f1a889d120b02bd2f1c7..cc6cceeccfac71cbf887d962135d48c60fadcab9 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -2784,6 +2784,9 @@ static bool isGridTrackFixedSized(const CSSValue& value)
if (value.isPrimitiveValue())
return isGridTrackFixedSized(toCSSPrimitiveValue(value));
+ if (value.isFunctionValue() && toCSSFunctionValue(value).functionType() == CSSValueFitContent)
+ return false;
+
const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(toCSSFunctionValue(value).item(0));
const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(toCSSFunctionValue(value).item(1));
return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(maxPrimitiveValue);
@@ -2917,6 +2920,17 @@ static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
result->append(*maxTrackBreadth);
return result;
}
+ if (token.functionId() == CSSValueFitContent) {
+ CSSParserTokenRange rangeCopy = range;
+ CSSParserTokenRange args = consumeFunction(rangeCopy);
+ CSSPrimitiveValue* trackBreadth = consumeGridBreadth(args, cssParserMode);
+ if (!trackBreadth || trackBreadth->isFlex() || !args.atEnd())
+ return nullptr;
+ range = rangeCopy;
+ CSSFunctionValue* result = CSSFunctionValue::create(CSSValueFitContent);
+ result->append(*trackBreadth);
+ return result;
Manuel Rego 2016/08/31 07:24:29 I'm wondering if it'd be nice to move this to a se
svillar 2016/08/31 09:50:04 That's a good idea. Actually using consumeGridBrea
+ }
return consumeGridBreadth(range, cssParserMode);
}

Powered by Google App Engine
This is Rietveld 408576698