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

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

Issue 2287113004: [css-grid] Implement fit-content track size (Closed)
Patch Set: Patch for landing 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..88dd27ead331c64c8c9e497f76dee0acfc9a5c9d 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -2714,6 +2714,19 @@ static CSSValue* consumeJustifyItems(CSSParserTokenRange& range)
return consumeSelfPositionOverflowPosition(range);
}
+static CSSValue* consumeFitContent(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ CSSParserTokenRange rangeCopy = range;
+ CSSParserTokenRange args = consumeFunction(rangeCopy);
+ CSSPrimitiveValue* length = consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
+ if (!length || !args.atEnd())
+ return nullptr;
+ range = rangeCopy;
+ CSSFunctionValue* result = CSSFunctionValue::create(CSSValueFitContent);
+ result->append(*length);
+ return result;
+}
+
static CSSCustomIdentValue* consumeCustomIdentForGridLine(CSSParserTokenRange& range)
{
if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan)
@@ -2784,8 +2797,13 @@ static bool isGridTrackFixedSized(const CSSValue& value)
if (value.isPrimitiveValue())
return isGridTrackFixedSized(toCSSPrimitiveValue(value));
- const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(toCSSFunctionValue(value).item(0));
- const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(toCSSFunctionValue(value).item(1));
+ DCHECK(value.isFunctionValue());
+ auto& function = toCSSFunctionValue(value);
+ if (function.functionType() == CSSValueFitContent)
+ return false;
+
+ const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(function.item(0));
+ const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(function.item(1));
return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(maxPrimitiveValue);
}
@@ -2917,6 +2935,10 @@ static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
result->append(*maxTrackBreadth);
return result;
}
+
+ if (token.functionId() == CSSValueFitContent)
+ return consumeFitContent(range, cssParserMode);
+
return consumeGridBreadth(range, cssParserMode);
}

Powered by Google App Engine
This is Rietveld 408576698