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

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

Issue 1484223002: Move transform-origin property into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years 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 67ac8543a35151e68bf41aaa78e1c453aa9b99bf..671cabfc3f002961a7a0be137603f8f8cbd322ae 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -721,6 +721,36 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumePosition(CSSParserTokenRange& ran
return nullptr;
}
+static bool consumeTransformOrigin(CSSParserTokenRange& range, CSSParserMode cssParserMode, UnitlessQuirk unitless, RefPtrWillBeRawPtr<CSSValue>& resultX, RefPtrWillBeRawPtr<CSSValue>& resultY)
+{
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> value1 = consumePositionComponent(range, cssParserMode, unitless);
+ if (!value1)
+ return false;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> value2 = consumePositionComponent(range, cssParserMode, unitless);
+ if (!value2) {
+ positionFromOneValue(value1.release(), resultX, resultY);
+ return true;
+ }
+ return positionFromTwoValues(value1.release(), value2.release(), resultX, resultY);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValueList> consumeTransformOrigin(CSSParserTokenRange& range, CSSParserMode cssParserMode, UnitlessQuirk unitless)
+{
+ RefPtrWillBeRawPtr<CSSValue> resultX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> resultY = nullptr;
+ if (consumeTransformOrigin(range, cssParserMode, unitless, resultX, resultY)) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(resultX.release());
+ list->append(resultY.release());
+ RefPtrWillBeRawPtr<CSSValue> resultZ = consumeLength(range, cssParserMode, ValueRangeAll);
+ if (!resultZ)
+ resultZ = cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pixels);
+ list->append(resultZ.release());
+ return list.release();
+ }
+ return nullptr;
+}
+
static inline bool isCSSWideKeyword(const CSSValueID& id)
{
return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueDefault;
@@ -2454,6 +2484,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeCursor(m_range);
case CSSPropertyContain:
return consumeContain(m_range);
+ case CSSPropertyTransformOrigin:
+ return consumeTransformOrigin(m_range, m_context.mode(), UnitlessQuirk::Forbid);
default:
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698