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

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

Issue 2375343002: CSS Motion Path: offset-shorthand requires path before distance rotation (Closed)
Patch Set: rebase Created 4 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/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 5699293aa7e0a0b411da7347ea41060f60caf947..40249ada98d9d535233d4fcd4942500fa97765b6 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1605,6 +1605,35 @@ CSSValue* consumeOffsetPosition(CSSParserTokenRange& range,
return consumePosition(range, cssParserMode, UnitlessQuirk::Forbid);
}
+bool CSSPropertyParser::consumeOffsetShorthand(bool important) {
alancutter (OOO until 2018) 2016/10/04 04:42:15 Add a comment with the grammar this is implementin
Eric Willigers 2016/10/04 04:59:39 Done.
+ const CSSValue* offsetPath = consumePathOrNone(m_range);
+ if (!offsetPath)
+ return false;
+
+ const CSSValue* offsetRotation = consumeOffsetRotation(m_range);
+ const CSSValue* offsetDistance =
+ consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll);
+ if (offsetDistance && !offsetRotation)
+ offsetRotation = consumeOffsetRotation(m_range);
+
+ addProperty(CSSPropertyOffsetPath, CSSPropertyOffset, *offsetPath, important);
+ addProperty(CSSPropertyOffsetDistance, CSSPropertyOffset,
+ offsetDistance ? *offsetDistance
+ : *CSSPrimitiveValue::create(
+ 0, CSSPrimitiveValue::UnitType::Pixels),
alancutter (OOO until 2018) 2016/10/04 05:00:18 Nit: Handle this the same way you handle !offsetRo
Eric Willigers 2016/10/04 05:20:31 Done.
+ important);
+
+ if (!offsetRotation) {
+ CSSValueList* list = CSSValueList::createSpaceSeparated();
+ list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto));
+ offsetRotation = list;
+ }
alancutter (OOO until 2018) 2016/10/04 05:00:18 I don't see a reason to mix up parsing and calls t
Eric Willigers 2016/10/04 05:20:31 Changed. This wasn't parsing, just creating defau
+ addProperty(CSSPropertyOffsetRotation, CSSPropertyOffset, *offsetRotation,
alancutter (OOO until 2018) 2016/10/04 05:00:18 I don't think we should be adding properties if we
Eric Willigers 2016/10/04 05:20:30 Changed. Font shorthand, for example, does add pro
+ important);
+
+ return m_range.atEnd();
+}
+
static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) {
CSSValueID id = range.peek().id();
if (id == CSSValueNone)
@@ -5067,7 +5096,7 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
case CSSPropertyMotion:
return consumeShorthandGreedily(motionShorthand(), important);
case CSSPropertyOffset:
- return consumeShorthandGreedily(offsetShorthand(), important);
+ return consumeOffsetShorthand(important);
case CSSPropertyWebkitTextEmphasis:
return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important);
case CSSPropertyOutline:

Powered by Google App Engine
This is Rietveld 408576698