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

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

Issue 2609933004: Implements CSSPropertyAPI for the column-gap property. (Closed)
Patch Set: rebase Created 3 years, 11 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 b4f14c9dd59fae7cff22b2e2300cd8d8491a9506..b7026024f480bb37b11503308688b32be3edd034 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -878,6 +878,41 @@ static CSSValue* consumeMarginOrOffset(CSSParserTokenRange& range,
return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, unitless);
}
+static CSSValue* consumeClipComponent(CSSParserTokenRange& range,
+ CSSParserMode cssParserMode) {
+ if (range.peek().id() == CSSValueAuto)
+ return consumeIdent(range);
+ return consumeLength(range, cssParserMode, ValueRangeAll,
+ UnitlessQuirk::Allow);
+}
+
+static CSSValue* consumeClip(CSSParserTokenRange& range,
+ CSSParserMode cssParserMode) {
+ if (range.peek().id() == CSSValueAuto)
+ return consumeIdent(range);
+
+ if (range.peek().functionId() != CSSValueRect)
+ return nullptr;
+
+ CSSParserTokenRange args = consumeFunction(range);
+ // rect(t, r, b, l) || rect(t r b l)
+ CSSValue* top = consumeClipComponent(args, cssParserMode);
+ if (!top)
+ return nullptr;
+ bool needsComma = consumeCommaIncludingWhitespace(args);
+ CSSValue* right = consumeClipComponent(args, cssParserMode);
+ if (!right || (needsComma && !consumeCommaIncludingWhitespace(args)))
+ return nullptr;
+ CSSValue* bottom = consumeClipComponent(args, cssParserMode);
+ if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args)))
+ return nullptr;
+ CSSValue* left = consumeClipComponent(args, cssParserMode);
+ if (!left || !args.atEnd())
+ return nullptr;
+ return CSSQuadValue::create(top, right, bottom, left,
+ CSSQuadValue::SerializeAsRect);
+}
+
static bool consumePan(CSSParserTokenRange& range,
CSSValue*& panX,
CSSValue*& panY,
@@ -968,13 +1003,6 @@ static CSSValue* consumeColumnCount(CSSParserTokenRange& range) {
return consumePositiveInteger(range);
}
-static CSSValue* consumeColumnGap(CSSParserTokenRange& range,
- CSSParserMode cssParserMode) {
- if (range.peek().id() == CSSValueNormal)
- return consumeIdent(range);
- return consumeLength(range, cssParserMode, ValueRangeNonNegative);
-}
-
static CSSValue* consumeColumnSpan(CSSParserTokenRange& range) {
return consumeIdent<CSSValueAll, CSSValueNone>(range);
}
@@ -3360,6 +3388,8 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
return consumeLengthOrPercent(m_range, m_context.mode(),
ValueRangeNonNegative,
UnitlessQuirk::Allow);
+ case CSSPropertyClip:
+ return consumeClip(m_range, m_context.mode());
case CSSPropertyTouchAction:
return consumeTouchAction(m_range);
case CSSPropertyScrollSnapDestination:
@@ -3378,8 +3408,6 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
return consumeColumnWidth(m_range);
case CSSPropertyColumnCount:
return consumeColumnCount(m_range);
- case CSSPropertyColumnGap:
- return consumeColumnGap(m_range, m_context.mode());
case CSSPropertyColumnSpan:
return consumeColumnSpan(m_range);
case CSSPropertyAnimationDelay:

Powered by Google App Engine
This is Rietveld 408576698