Chromium Code Reviews| Index: Source/core/css/CSSParser.cpp |
| diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp |
| index db234f0e895b73a5d06b67835c85481205114562..e6ead7d3ac52e5b1b9276277f88c0b32d9cb0af7 100644 |
| --- a/Source/core/css/CSSParser.cpp |
| +++ b/Source/core/css/CSSParser.cpp |
| @@ -11350,9 +11350,17 @@ void CSSParser::deleteFontFaceOnlyValues() |
| StyleKeyframe* CSSParser::createKeyframe(CSSParserValueList* keys) |
| { |
| - // Create a key string from the passed keys |
| - StringBuilder keyString; |
| - for (unsigned i = 0; i < keys->size(); ++i) { |
| + Vector<float> keyframeKeys; |
| + unsigned keyCount = keys->size(); |
| + for (unsigned i = 0; i < keyCount; ++i) { |
|
apavlov
2013/06/18 09:59:50
IIRC, Vector::size() returns a size_t, so while we
|
| + // Just as per the comment below, we ignore keyframes with |
| + // invalid key values (plain numbers or unknown identifiers) |
| + // marked as CSSPrimitiveValue::CSS_UNKNOWN during parsing. |
| + if (keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_UNKNOWN) { |
| + clearProperties(); |
| + return 0; |
| + } |
| + |
| ASSERT(keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_NUMBER); |
| float key = static_cast<float>(keys->valueAt(i)->fValue); |
| if (key < 0 || key > 100) { |
| @@ -11362,14 +11370,12 @@ StyleKeyframe* CSSParser::createKeyframe(CSSParserValueList* keys) |
| clearProperties(); |
| return 0; |
| } |
| - if (i != 0) |
| - keyString.append(','); |
| - keyString.append(String::number(key)); |
| - keyString.append('%'); |
| + |
| + keyframeKeys.append(key / 100); |
| } |
| RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create(); |
| - keyframe->setKeyText(keyString.toString()); |
| + keyframe->setKeys(keyframeKeys); |
| keyframe->setProperties(createStylePropertySet()); |
| clearProperties(); |