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

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: comment 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..41fc5a985bd8028d2567546cc057b5c911ff4f82 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1605,6 +1605,36 @@ CSSValue* consumeOffsetPosition(CSSParserTokenRange& range,
return consumePosition(range, cssParserMode, UnitlessQuirk::Forbid);
}
+// offset: <offset-path> [ <offset-distance>? && <offset-rotation>? ]
+bool CSSPropertyParser::consumeOffsetShorthand(bool important) {
+ 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),
+ important);
+
+ if (!offsetRotation) {
+ CSSValueList* list = CSSValueList::createSpaceSeparated();
+ list->append(*CSSIdentifierValue::create(CSSValueAuto));
+ offsetRotation = list;
+ }
+ addProperty(CSSPropertyOffsetRotation, CSSPropertyOffset, *offsetRotation,
+ important);
+
+ return m_range.atEnd();
+}
+
static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) {
CSSValueID id = range.peek().id();
if (id == CSSValueNone)
@@ -5067,7 +5097,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