Correctly handle prefixed and unprefixed variants in CSSStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=157569
<rdar://problem/26223115>
Patch by Antoine Quint <Antoine Quint> on 2016-05-12
Reviewed by Dean Jackson.
Source/WebCore:
Tests: fast/css/prefixed-unprefixed-variant-style-declaration.html
fast/css/shorthand-omitted-initial-value-overrides-shorthand.html
We essentially revert the code added with https://bugs.webkit.org/show_bug.cgi?id=110011
which duplicated properties that had a prefixed or unprefixed variant. What we do now is
to return the value of the prefixed or unprefixed variant through a CSSStyleDeclaration,
but only return the properties specified by the author when reading from the cssText property.
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseTransitionShorthand):
(WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted.
Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.
Treat transition properties as we do animation properties.
- css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
Make these two methods call into the matching getXXXInternal() variant instead
of going through the property set directly so that they would correctly pick up
on the prefixed or unprefixed variant should there be one when the specified property
is not specified directly.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
We used to simply return the value for the given property from the property set, which
we still do but now also check if there is prefixed or unprefixed variant for the provided
property in case it was absent.
(WebCore::MutableStyleProperties::removeShorthandProperty):
Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.
(WebCore::StyleProperties::asText):
Drive-by fix to also handle the animation-play-state and -webkit-animation-play-state properties
when serializing to the shorthand.
(WebCore::MutableStyleProperties::removeProperty): Deleted.
(WebCore::MutableStyleProperties::removePrefixedOrUnprefixedProperty): Deleted.
(WebCore::MutableStyleProperties::setProperty): Deleted.
(WebCore::getIndexInShorthandVectorForPrefixingVariant): Deleted.
(WebCore::MutableStyleProperties::appendPrefixingVariantProperty): Deleted.
(WebCore::MutableStyleProperties::setPrefixingVariantProperty): Deleted.
Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.
LayoutTests:
- animations/fill-mode-forwards-zero-duration.html:
- animations/play-state-start-paused.html:
These two tests incorrectly expected a shorthand property not to reset
longhand properties that it covers to their initial values even if left
out of the shorthand.
- animations/unprefixed-properties-expected.txt:
- animations/unprefixed-properties.html:
This test incorrectly expected that setting an unprefixed property only would
lead to reading the prefixed property through the CSSOM return the empty string,
rather than the value set on the unprefixed property.
- fast/css/prefixed-unprefixed-variant-style-declaration-expected.txt: Added.
- fast/css/prefixed-unprefixed-variant-style-declaration.html: Added.
New test checking that setting one of two of a property's unprefixed and prefixed
variants correctly allows to read the style through the CSS OM for both variants,
while only serializing the property that was set through cssText.
- fast/css/shorthand-omitted-initial-value-overrides-shorthand-expected.txt: Added.
- fast/css/shorthand-omitted-initial-value-overrides-shorthand.html: Added.
New test checking that setting a longhand property and then the shorthand for that
longhand correctly resets the initial values, even if they were omitted in the shorthand.