haikuwebkit/LayoutTests/animations/unprefixed-shorthand-expect...

138 lines
4.1 KiB
Plaintext
Raw Permalink Normal View History

Support unprefixed animation property names https://bugs.webkit.org/show_bug.cgi?id=138678 <rdar://problem/18943059> Reviewed by Simon Fraser. Source/WebCore: Step 1 of 3 in unprefixing CSS animations: handling the property names and values. Unlike other unprefixing, where we use an alias that effectively removes the prefixed values from the code, for animations we need to keep the old values around so that existing content will not break (e.g. computed style). During testing I noticed that we didn't handle the (relatively) new animation-direction values of "reverse" and "alternate-reverse" when querying computed style. Tests: animations/unprefixed-properties.html animations/unprefixed-shorthand.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): Handle the unprefixed values, but also get animation direction to produce the correct results when "reverse" and "alternate-reverse" is specified. * css/CSSParser.cpp: Handle the new values. If necessary, pass a flag around indicating whether it is prefixed or unprefixed. (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseAnimationShorthand): Use the flag to decide which of the forms we're going to check. (WebCore::CSSParser::parseAnimationProperty): * css/CSSParser.h: * css/CSSProperty.h: (WebCore::prefixingVariantForPropertyId): Add prefixing/unprefixing variants for all the animation values, and clean up the code a bit. * css/CSSPropertyNames.in: Add new properties. * css/DeprecatedStyleBuilder.cpp: (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): We need handlers for the unprefixed forms. This should move to the new StyleBuilder soon. * css/StyleProperties.cpp: Handle new values. (WebCore::StyleProperties::getPropertyValue): (WebCore::StyleProperties::asText): * css/StylePropertyShorthand.cpp: (WebCore::animationShorthand): (WebCore::animationShorthandForParsing): Decide which list of properties to use. (WebCore::shorthandForProperty): (WebCore::matchingShorthandsForLonghand): (WebCore::webkitAnimationShorthandForParsing): Deleted. * css/StylePropertyShorthand.h: * css/StyleResolver.cpp: Since the new properties come before "background" in alphabetical order, they are earlier in the CSSPropertyNames.in file, and thus we need to update the call sites that think CSSPropertyBackground is the first property. (WebCore::StyleResolver::styleForKeyframe): Replace CSSPropertyBackground with CSSPropertyAnimation. (WebCore::StyleResolver::styleForPage): (WebCore::StyleResolver::applyMatchedProperties): (WebCore::StyleResolver::applyProperty): LayoutTests: Tests for unprefixed parsing and calculation of animation properties. Fun fact, this is the first test we have for the computed style of all animation-direction values. * animations/unprefixed-properties-expected.txt: Added. * animations/unprefixed-properties.html: Added. * animations/unprefixed-shorthand-expected.txt: Added. * animations/unprefixed-shorthand.html: Added. Canonical link: https://commits.webkit.org/156530@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-11-13 01:23:15 +00:00
Test the unprefixed animation shorthand.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Setting animation: waldo
Check animation-name
PASS animationStyle.cssText is 'waldo'
Check animation-duration
PASS animationStyle.cssText is '0s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: waldo 2s
Check animation-name
PASS animationStyle.cssText is 'waldo'
Check animation-duration
PASS animationStyle.cssText is '2s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: 3s banana 500ms
Check animation-name
PASS animationStyle.cssText is 'banana'
Check animation-duration
PASS animationStyle.cssText is '3s'
Check animation-delay
PASS animationStyle.cssText is '0.5s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: infinite alternate eggs 5s
Check animation-name
PASS animationStyle.cssText is 'eggs'
Check animation-duration
PASS animationStyle.cssText is '5s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is 'infinite'
Check animation-direction
PASS animationStyle.cssText is 'alternate'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: forwards normal ease-in-out bacon 1s 2s
Check animation-name
PASS animationStyle.cssText is 'bacon'
Check animation-duration
PASS animationStyle.cssText is '1s'
Check animation-delay
PASS animationStyle.cssText is '2s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease-in-out'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'forwards'
Setting animation: pastrami 100ms cubic-bezier(0, 0, 1, 1) alternate-reverse
Check animation-name
PASS animationStyle.cssText is 'pastrami'
Check animation-duration
PASS animationStyle.cssText is '0.1s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'cubic-bezier(0, 0, 1, 1)'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'alternate-reverse'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: slightly-invalid 2s a
Check animation-name
PASS animationStyle.cssText is 'none'
Check animation-duration
PASS animationStyle.cssText is '0s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
Setting animation: completely invalid
Check animation-name
PASS animationStyle.cssText is 'none'
Check animation-duration
PASS animationStyle.cssText is '0s'
Check animation-delay
PASS animationStyle.cssText is '0s'
Check animation-timing-function
PASS animationStyle.cssText is 'ease'
Check animation-iteration-count
PASS animationStyle.cssText is '1'
Check animation-direction
PASS animationStyle.cssText is 'normal'
Check animation-fill-mode
PASS animationStyle.cssText is 'none'
PASS successfullyParsed is true
TEST COMPLETE