| Index: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
|
| index 768add52802b42578eee606f601bf66e7054eaa2..6c3b49aa0a032847d81d1f19d2955434d8cdb17a 100644
|
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
|
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
|
| @@ -900,6 +900,31 @@ static bool parseTransformNumberArguments(CharType*& pos, CharType* end, unsigne
|
| }
|
|
|
| template <typename CharType>
|
| +static bool parseTransformRotateArguments(CharType*& pos, CharType* end, CSSFunctionValue* transformValue)
|
| +{
|
| + static const int kDegLength = 3;
|
| +
|
| + size_t delimiter = WTF::find(pos, end - pos, ')');
|
| + if (delimiter == kNotFound)
|
| + return false;
|
| + CharType* degreeStart = pos + delimiter - kDegLength;
|
| + bool isDegree = degreeStart > pos // require at least one digit.
|
| + && toASCIILower(degreeStart[0]) == 'd'
|
| + && toASCIILower(degreeStart[1]) == 'e'
|
| + && toASCIILower(degreeStart[2]) == 'g';
|
| + if (!isDegree)
|
| + return false;
|
| + unsigned argumentLength = static_cast<unsigned>(delimiter - kDegLength);
|
| + bool ok;
|
| + double number = charactersToDouble(pos, argumentLength, &ok);
|
| + if (!ok)
|
| + return false;
|
| + transformValue->append(cssValuePool().createValue(number, CSSPrimitiveValue::UnitType::Degrees));
|
| + pos += delimiter + 1;
|
| + return true;
|
| +}
|
| +
|
| +template <typename CharType>
|
| static CSSFunctionValue* parseSimpleTransformValue(CharType*& pos, CharType* end)
|
| {
|
| static const int shortestValidTransformStringLength = 12;
|
| @@ -981,6 +1006,36 @@ static CSSFunctionValue* parseSimpleTransformValue(CharType*& pos, CharType* end
|
| return transformValue;
|
| }
|
|
|
| + const bool isRotate = toASCIILower(pos[0]) == 'r'
|
| + && toASCIILower(pos[1]) == 'o'
|
| + && toASCIILower(pos[2]) == 't'
|
| + && toASCIILower(pos[3]) == 'a'
|
| + && toASCIILower(pos[4]) == 't'
|
| + && toASCIILower(pos[5]) == 'e';
|
| +
|
| + if (isRotate) {
|
| + CSSValueID transformType;
|
| + unsigned argumentStart = 8;
|
| + CharType c6 = toASCIILower(pos[6]);
|
| + if (c6 == 'x' && pos[7] == '(') {
|
| + transformType = CSSValueRotateX;
|
| + } else if (c6 == 'y' && pos[7] == '(') {
|
| + transformType = CSSValueRotateY;
|
| + } else if (c6 == 'z' && pos[7] == '(') {
|
| + transformType = CSSValueRotateZ;
|
| + } else if (c6 == '(') {
|
| + transformType = CSSValueRotate;
|
| + argumentStart = 7;
|
| + } else {
|
| + return nullptr;
|
| + }
|
| + pos += argumentStart;
|
| + CSSFunctionValue* transformValue = CSSFunctionValue::create(transformType);
|
| + if (!parseTransformRotateArguments(pos, end, transformValue))
|
| + return nullptr;
|
| + return transformValue;
|
| + }
|
| +
|
| return nullptr;
|
| }
|
|
|
|
|