| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 11260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11271 continue; | 11271 continue; |
| 11272 } | 11272 } |
| 11273 ++i; | 11273 ++i; |
| 11274 } | 11274 } |
| 11275 } | 11275 } |
| 11276 | 11276 |
| 11277 StyleKeyframe* CSSParser::createKeyframe(CSSParserValueList* keys) | 11277 StyleKeyframe* CSSParser::createKeyframe(CSSParserValueList* keys) |
| 11278 { | 11278 { |
| 11279 // Create a key string from the passed keys | 11279 // Create a key string from the passed keys |
| 11280 StringBuilder keyString; | 11280 StringBuilder keyString; |
| 11281 |
| 11281 for (unsigned i = 0; i < keys->size(); ++i) { | 11282 for (unsigned i = 0; i < keys->size(); ++i) { |
| 11283 // Just as per the comment below, we ignore keyframes with |
| 11284 // invalid key values (plain numbers or unknown identifiers) |
| 11285 // marked as isInt during parsing. |
| 11286 if (keys->valueAt(i)->isInt) { |
| 11287 clearProperties(); |
| 11288 return 0; |
| 11289 } |
| 11282 float key = static_cast<float>(keys->valueAt(i)->fValue); | 11290 float key = static_cast<float>(keys->valueAt(i)->fValue); |
| 11291 if (key < 0 || key > 100) { |
| 11292 // As per http://www.w3.org/TR/css3-animations/#keyframes, |
| 11293 // "If a keyframe selector specifies negative percentage values |
| 11294 // or values higher than 100%, then the keyframe will be ignored." |
| 11295 clearProperties(); |
| 11296 return 0; |
| 11297 } |
| 11283 if (i != 0) | 11298 if (i != 0) |
| 11284 keyString.append(','); | 11299 keyString.append(','); |
| 11285 keyString.append(String::number(key)); | 11300 keyString.append(String::number(key)); |
| 11286 keyString.append('%'); | 11301 keyString.append('%'); |
| 11287 } | 11302 } |
| 11288 | 11303 |
| 11289 RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create(); | 11304 RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create(); |
| 11290 keyframe->setKeyText(keyString.toString()); | 11305 keyframe->setKeyText(keyString.toString()); |
| 11291 keyframe->setProperties(createStylePropertySet()); | 11306 keyframe->setProperties(createStylePropertySet()); |
| 11292 | 11307 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11716 { | 11731 { |
| 11717 // The tokenizer checks for the construct of an+b. | 11732 // The tokenizer checks for the construct of an+b. |
| 11718 // However, since the {ident} rule precedes the {nth} rule, some of those | 11733 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11719 // tokens are identified as string literal. Furthermore we need to accept | 11734 // tokens are identified as string literal. Furthermore we need to accept |
| 11720 // "odd" and "even" which does not match to an+b. | 11735 // "odd" and "even" which does not match to an+b. |
| 11721 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11736 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11722 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11737 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11723 } | 11738 } |
| 11724 | 11739 |
| 11725 } | 11740 } |
| OLD | NEW |