Chromium Code Reviews| Index: Source/core/css/StylePropertyShorthandCustom.cpp | 
| diff --git a/Source/core/css/StylePropertyShorthandCustom.cpp b/Source/core/css/StylePropertyShorthandCustom.cpp | 
| index e49efe5739f45dbec11ebe3de580dfa6d11d97ff..1e6e628c34091ae91ad949e11eaae9bf4363638b 100644 | 
| --- a/Source/core/css/StylePropertyShorthandCustom.cpp | 
| +++ b/Source/core/css/StylePropertyShorthandCustom.cpp | 
| @@ -36,6 +36,30 @@ const StylePropertyShorthand& borderShorthandForParsing() | 
| return borderForParsingLonghands; | 
| } | 
| +const StylePropertyShorthand& animationShorthandForParsing() | 
| +{ | 
| + // When we parse the animation shorthand we need to look for animation-name | 
| + // last because otherwise it might match against the keywords for fill mode, | 
| + // timing functions and infinite iteration. This means that animation names | 
| + // that are the same as keywords (e.g. 'forwards') won't always match in the | 
| + // shorthand. In that case the authors should be using longhands (or | 
| + // reconsidering their approach). This is covered by the animations spec | 
| + // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 | 
| + // And in the spec (editor's draft) at: | 
| + // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property | 
| + static const CSSPropertyID animationPropertiesForParsing[] = { | 
| + CSSPropertyAnimationDuration, | 
| + CSSPropertyAnimationTimingFunction, | 
| + CSSPropertyAnimationDelay, | 
| + CSSPropertyAnimationIterationCount, | 
| + CSSPropertyAnimationDirection, | 
| + CSSPropertyAnimationFillMode, | 
| + CSSPropertyAnimationName | 
| + }; | 
| + DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing))); | 
| + return webkitAnimationLonghandsForParsing; | 
| +} | 
| + | 
| const StylePropertyShorthand& webkitAnimationShorthandForParsing() | 
| { | 
| // When we parse the animation shorthand we need to look for animation-name | 
| @@ -60,6 +84,21 @@ const StylePropertyShorthand& webkitAnimationShorthandForParsing() | 
| return webkitAnimationLonghandsForParsing; | 
| } | 
| +// Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing. | 
| +const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID propertyID) | 
| 
 
eseidel
2013/08/13 17:49:15
I'm confused by this new wrapper around shorthandF
 
darktears
2013/08/13 18:08:54
No. When we parse the shorthand properties we star
 
 | 
| +{ | 
| + switch (propertyID) { | 
| + case CSSPropertyAnimation: | 
| + return animationShorthandForParsing(); | 
| + case CSSPropertyBorder: | 
| + return borderShorthandForParsing(); | 
| + case CSSPropertyWebkitAnimation: | 
| + return webkitAnimationShorthandForParsing(); | 
| + default: | 
| + return shorthandForProperty(propertyID); | 
| + } | 
| +} | 
| + | 
| bool isExpandedShorthand(CSSPropertyID id) | 
| { | 
| // The system fonts bypass the normal style resolution by using RenderTheme, |