Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index 119ea6bf959ffa64c81bf48d7c10d1bf913d9a73..28522869f4a88160a0c1ccd067843b7118b63d3a 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -1096,6 +1096,89 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import |
| addProperty(propId, list.release(), important); |
| return true; |
| } |
| + |
| + case CSSPropertyTranslate: { |
| + // translate : [ <length> | <percentage> ] [[ <length> | <percentage> ] <length>? ]? |
| + // defaults to 0 on all axis, note that the last value CANNOT be a percentage |
| + ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| + if (!validUnit(value, FLength) && !validUnit(value, FPercent)) { |
| + return false; |
| + } |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + |
| + if (value) { |
| + if (!validUnit(value, FLength) && !validUnit(value, FPercent)) |
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + |
| + if (value) { |
| + if (!validUnit(value, FNumber)) |
| + return false; |
| + |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } else { |
| + list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER)); |
| + } |
| + |
| + } else { |
| + list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX)); |
| + } |
| + |
| + parsedValue = list.release(); |
| + break; |
| + } |
| + |
| + case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1 |
| + ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| + const unsigned maxAxis = 3; |
| + |
| + if (!validUnit(value, FAngle)) |
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + |
| + if (m_valueList->size() == 1) { |
| + parsedValue = list.release(); |
| + break; |
| + } |
| + |
| + if (m_valueList->size() != maxAxis + 1) |
| + return false; |
| + |
| + for (unsigned i = 0; i < maxAxis; i++) { |
| + if (!validUnit(value, FNumber)) |
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } |
| + parsedValue = list.release(); |
| + break; |
| + } |
| + |
| + case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1 |
| + ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
| + RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createCommaSeparated(); |
| + const unsigned maxAxis = 3; |
| + |
| + for (unsigned i = 0; i < m_valueList->size(); i++) { |
| + if (!validUnit(value, FNumber)) |
| + return false; |
| + scaleList->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } |
| + |
| + for (unsigned i = 0; i < maxAxis - m_valueList->size(); i++) |
|
Eric Willigers
2015/06/05 01:58:22
Perhaps while (scalaList size < ...)
soonm
2015/06/10 04:09:32
Changed - minimal css properties, so there's no ne
|
| + scaleList->append(cssValuePool().createValue(1, CSSPrimitiveValue::CSS_NUMBER)); |
| + |
| + parsedValue = scaleList.release(); |
| + break; |
| + } |
| + |
| case CSSPropertyWebkitPerspectiveOriginX: |
| case CSSPropertyWebkitTransformOriginX: |
| parsedValue = parseFillPositionX(m_valueList); |