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

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

Issue 474873002: Clean parsing for -webkit-transform-origin* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index d75113c3692c94813119f167c5be3f5e1ba1179f..41ed45a8cc232586e7808a966ccd149e8730a943 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1151,24 +1151,21 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
addProperty(propId, list.release(), important);
return true;
}
- case CSSPropertyWebkitTransformOrigin:
case CSSPropertyWebkitTransformOriginX:
+ parsedValue = parseFillPositionX(m_valueList.get());
+ if (parsedValue)
+ m_valueList->next();
+ break;
case CSSPropertyWebkitTransformOriginY:
- case CSSPropertyWebkitTransformOriginZ: {
- RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
- RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
- RefPtrWillBeRawPtr<CSSValue> val3 = nullptr;
- CSSPropertyID propId1, propId2, propId3;
- if (parseWebkitTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) {
- addProperty(propId1, val1.release(), important);
- if (val2)
- addProperty(propId2, val2.release(), important);
- if (val3)
- addProperty(propId3, val3.release(), important);
- return true;
- }
- return false;
- }
+ parsedValue = parseFillPositionY(m_valueList.get());
+ if (parsedValue)
+ m_valueList->next();
+ break;
+ case CSSPropertyWebkitTransformOriginZ:
+ validPrimitive = validUnit(value, FLength);
+ break;
+ case CSSPropertyWebkitTransformOrigin:
+ return parseWebkitTransformOriginShorthand(important);
case CSSPropertyPerspective:
if (id == CSSValueNone) {
validPrimitive = true;
@@ -3134,20 +3131,27 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty()
return createPrimitiveStringValue(value);
}
-bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSValue>& value3)
+bool CSSPropertyParser::parseWebkitTransformOriginShorthand(bool important)
{
- parse2ValuesFillPosition(m_valueList.get(), value1, value2);
+ RefPtrWillBeRawPtr<CSSValue> originX;
+ RefPtrWillBeRawPtr<CSSValue> originY;
+ parse2ValuesFillPosition(m_valueList.get(), originX, originY);
- // now get z
- if (m_valueList->current()) {
- if (validUnit(m_valueList->current(), FLength)) {
- value3 = createPrimitiveNumericValue(m_valueList->current());
- m_valueList->next();
- return true;
- }
+ if (m_valueList->current() && !validUnit(m_valueList->current(), FLength))
return false;
alancutter (OOO until 2018) 2014/08/15 01:00:03 This can be merged into the if block below.
Timothy Loh 2014/08/15 01:03:18 Not sure what you mean here, the "if (m_valueList-
Timothy Loh 2014/08/15 01:11:41 err yeah I can move adding properties lower, will
Timothy Loh 2014/08/15 01:26:41 Done.
+
+ addProperty(CSSPropertyWebkitTransformOriginX, originX.release(), important);
+ addProperty(CSSPropertyWebkitTransformOriginY, originY.release(), important);
+
+ RefPtrWillBeRawPtr<CSSValue> originZ;
+ if (m_valueList->current()) {
+ originZ = createPrimitiveNumericValue(m_valueList->current());
+ m_valueList->next();
+ } else {
+ originZ = cssValuePool().createImplicitInitialValue();
}
- value3 = cssValuePool().createImplicitInitialValue();
+ addProperty(CSSPropertyWebkitTransformOriginZ, originZ.release(), important);
+
return true;
}
@@ -7562,50 +7566,6 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransformOrigin()
return list.release();
}
-bool CSSPropertyParser::parseWebkitTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtrWillBeRawPtr<CSSValue>& value, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSValue>& value3)
-{
- propId1 = propId;
- propId2 = propId;
- propId3 = propId;
- if (propId == CSSPropertyWebkitTransformOrigin) {
- propId1 = CSSPropertyWebkitTransformOriginX;
- propId2 = CSSPropertyWebkitTransformOriginY;
- propId3 = CSSPropertyWebkitTransformOriginZ;
- }
-
- switch (propId) {
- case CSSPropertyWebkitTransformOrigin:
- if (!parseWebkitTransformOriginShorthand(value, value2, value3))
- return false;
- // parseWebkitTransformOriginShorthand advances the m_valueList pointer
- break;
- case CSSPropertyWebkitTransformOriginX: {
- value = parseFillPositionX(m_valueList.get());
- if (value)
- m_valueList->next();
- break;
- }
- case CSSPropertyWebkitTransformOriginY: {
- value = parseFillPositionY(m_valueList.get());
- if (value)
- m_valueList->next();
- break;
- }
- case CSSPropertyWebkitTransformOriginZ: {
- if (validUnit(m_valueList->current(), FLength))
- value = createPrimitiveNumericValue(m_valueList->current());
- if (value)
- m_valueList->next();
- break;
- }
- default:
- ASSERT_NOT_REACHED();
- return false;
- }
-
- return value;
-}
-
bool CSSPropertyParser::parseWebkitPerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, RefPtrWillBeRawPtr<CSSValue>& value, RefPtrWillBeRawPtr<CSSValue>& value2)
{
propId1 = propId;
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698