StylePropertyShorthand animationShorthandForParsing(CSSPropertyID propId) { // 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 }; static const CSSPropertyID prefixedAnimationPropertiesForParsing[] = { CSSPropertyWebkitAnimationDuration, CSSPropertyWebkitAnimationTimingFunction, CSSPropertyWebkitAnimationDelay, CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection, CSSPropertyWebkitAnimationFillMode, CSSPropertyWebkitAnimationName }; if (propId == CSSPropertyAnimation) return StylePropertyShorthand(CSSPropertyAnimation, animationPropertiesForParsing); return StylePropertyShorthand(CSSPropertyWebkitAnimation, prefixedAnimationPropertiesForParsing); }
StylePropertyShorthand animationShorthandForParsing(CSSPropertyID propId) { // Animation-name must come last, so that keywords for other properties in the shorthand // preferentially match those properties. static const CSSPropertyID animationPropertiesForParsing[] = { CSSPropertyAnimationDuration, CSSPropertyAnimationTimingFunction, CSSPropertyAnimationDelay, CSSPropertyAnimationIterationCount, CSSPropertyAnimationDirection, CSSPropertyAnimationFillMode, CSSPropertyAnimationPlayState, CSSPropertyAnimationName }; static const CSSPropertyID prefixedAnimationPropertiesForParsing[] = { CSSPropertyWebkitAnimationDuration, CSSPropertyWebkitAnimationTimingFunction, CSSPropertyWebkitAnimationDelay, CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection, CSSPropertyWebkitAnimationFillMode, CSSPropertyWebkitAnimationPlayState, CSSPropertyWebkitAnimationName }; if (propId == CSSPropertyAnimation) return StylePropertyShorthand(CSSPropertyAnimation, animationPropertiesForParsing); return StylePropertyShorthand(CSSPropertyWebkitAnimation, prefixedAnimationPropertiesForParsing); }
StylePropertyShorthand borderAbridgedShorthand() { static const CSSPropertyID borderAbridgedProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor }; #if !PLATFORM(WKC) static const StylePropertyShorthand propertiesForInitialization[] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() }; #else static StylePropertyShorthand propertiesForInitialization[] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() }; WKC_DEFINE_STATIC_BOOL(inited, false); if (!inited) { inited = true; propertiesForInitialization[0] = borderWidthShorthand(); propertiesForInitialization[1] = borderStyleShorthand(); propertiesForInitialization[2] = borderColorShorthand(); } #endif return StylePropertyShorthand(CSSPropertyBorder, borderAbridgedProperties, propertiesForInitialization); }
StylePropertyShorthand borderAbridgedShorthand() { static const CSSPropertyID borderAbridgedProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor }; static const StylePropertyShorthand propertiesForInitialization[] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() }; return StylePropertyShorthand(CSSPropertyBorder, borderAbridgedProperties, propertiesForInitialization); }