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

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

Issue 1386703002: Move rotation property handling into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 891dd76559c8d2be3c5150afb171e7138f8d4086..e746827912449a437188a22e750c36422013e339 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -271,6 +271,28 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLengthOrPercent(CSSParse
return nullptr;
}
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range)
+{
+ const CSSParserToken& token = range.peek();
+ if (token.type() == DimensionToken) {
+ switch (token.unitType()) {
+ case CSSPrimitiveValue::UnitType::Degrees:
+ case CSSPrimitiveValue::UnitType::Radians:
+ case CSSPrimitiveValue::UnitType::Gradians:
+ case CSSPrimitiveValue::UnitType::Turns:
+ return cssValuePool().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
+ default:
+ return nullptr;
+ }
+ }
+ CalcParser calcParser(range, ValueRangeAll);
+ if (const CSSCalcValue* calculation = calcParser.value()) {
+ if (calculation->category() == CalcAngle)
+ return calcParser.consumeValue();
+ }
+ return nullptr;
+}
+
static inline bool isCSSWideKeyword(const CSSValueID& id)
{
return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueDefault;
@@ -578,6 +600,29 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineHeight(CSSParserToke
return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative);
}
+static PassRefPtrWillBeRawPtr<CSSValueList> consumeRotation(CSSParserTokenRange& range)
+{
+ ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled());
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+
+ RefPtrWillBeRawPtr<CSSValue> rotation = consumeAngle(range);
+ if (!rotation)
+ return nullptr;
+ list->append(rotation.release());
+
+ if (range.atEnd())
+ return list.release();
+
+ for (unsigned i = 0; i < 3; i++) { // 3 dimensions of rotation
+ RefPtrWillBeRawPtr<CSSValue> dimension = consumeNumber(range, ValueRangeAll);
+ if (!dimension)
+ return nullptr;
+ list->append(dimension.release());
+ }
+
+ return list.release();
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
{
m_range.consumeWhitespace();
@@ -609,6 +654,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeFontSize(m_range, m_context.mode());
case CSSPropertyLineHeight:
return consumeLineHeight(m_range, m_context.mode());
+ case CSSPropertyRotate:
+ return consumeRotation(m_range);
default:
return nullptr;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698