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 cff57228075f10f03eacfd1a293a91d282d2b6c5..904e99ddff93e2824eb274f358987c2ca865ef00 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -1096,6 +1096,84 @@ 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::createSpaceSeparated(); |
| + 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)) |
|
Timothy Loh
2015/06/10 04:22:29
validUnit(value, FLength | FPercent), also add tes
soonm
2015/06/11 23:31:03
Done.
|
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + |
| + if (value) { |
| + if (!validUnit(value, FLength)) |
| + return false; |
| + |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } |
| + } |
| + |
| + parsedValue = list.release(); |
| + break; |
| + } |
| + |
| + case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1 |
| + ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| + const unsigned maxAxis = 3; |
| + |
| + if (!validUnit(value, FAngle)) |
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + |
| + if (!value) { |
| + parsedValue = list.release(); |
| + break; |
| + } |
| + |
| + for (unsigned i = 0; i < maxAxis; i++) { |
| + if (!value || !validUnit(value, FNumber)) |
| + return false; |
| + list->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } |
| + |
| + parsedValue = list.release(); |
| + if (value) |
|
Timothy Loh
2015/06/10 04:22:29
don't need, checked outside the switch statement
soonm
2015/06/11 23:31:04
Done - Removed
|
| + return false; |
| + break; |
| + } |
| + |
| + case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1 |
| + ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
| + RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createSpaceSeparated(); |
| + const unsigned maxAxis = 3; |
| + |
| + for (unsigned i = 0; value && i < maxAxis; i++) { |
| + if (!validUnit(value, FNumber)) |
| + return false; |
| + scaleList->append(createPrimitiveNumericValue(value)); |
| + value = m_valueList->next(); |
| + } |
| + |
| + if (value) |
|
Timothy Loh
2015/06/10 04:22:29
don't need, checked outside the switch statement
soonm
2015/06/11 23:31:04
Done - Removed
|
| + return false; |
| + |
| + parsedValue = scaleList.release(); |
| + break; |
| + } |
| + |
| case CSSPropertyWebkitPerspectiveOriginX: |
| case CSSPropertyWebkitTransformOriginX: |
| parsedValue = parseFillPositionX(m_valueList); |