Support unprefixed animation property names
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Nov 2014 01:23:15 +0000 (01:23 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Nov 2014 01:23:15 +0000 (01:23 +0000)
commit8b459ca6f909514d9fa49629ba3df7a151d24cd3
tree43cee6ee4a4abff5a724e4a468b2e107735d0ec2
parent26ed4b0c6985547cf1b4de70b5978c35a552ddc3
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/unprefixed-properties-expected.txt [new file with mode: 0644]
LayoutTests/animations/unprefixed-properties.html [new file with mode: 0644]
LayoutTests/animations/unprefixed-shorthand-expected.txt [new file with mode: 0644]
LayoutTests/animations/unprefixed-shorthand.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/StyleProperties.cpp
Source/WebCore/css/StylePropertyShorthand.cpp
Source/WebCore/css/StylePropertyShorthand.h
Source/WebCore/css/StyleResolver.cpp