Specifying a longhand property should not serialize to a shorthand property
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2016 02:25:31 +0000 (02:25 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2016 02:25:31 +0000 (02:25 +0000)
commit72a400e1e46e2630d5a96fb803a3cd26374a950d
treed7dea5c33ac8dec309f19050c6ca3e2f92b535ed
parentfb7cd5b3c32bf84a1e79525f9e420c159dc87f26
Specifying a longhand property should not serialize to a shorthand property
https://bugs.webkit.org/show_bug.cgi?id=157180

Patch by Antoine Quint <graouts@apple.com> on 2016-05-02
Reviewed by Dean Jackson.

Source/WebCore:

Ensure that we don't serialize to a shorthand property when the required longhand components
are not specified, per http://www.w3.org/TR/cssom-1/#serialize-a-css-declaration-block.

Test: fast/css/no-shorthand-with-incomplete-longhands.html

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getLayeredShorthandValue):
Returning an empty string here means that calling getPropertyValue() with
the shorthand property matching the currently processed longhand property
in asText() will return an empty string as well and the shorthand property
will be disregarded.

LayoutTests:

A fair few tests relied on reading from a shorthand value when it was incorrect
to produce one, so we fix those incorrect assertions. We also add a new test that
goes through all the longhand properties for a given shorthand property and checks
that none of the longhand properties will yield a shorthand value.

* cssom/cssvalue-comparison-expected.txt:
* cssom/cssvalue-comparison.html:
* fast/css/background-position-serialize-expected.txt:
* fast/css/background-position-serialize.html:
* fast/css/no-shorthand-with-incomplete-longhands-expected.txt: Added.
* fast/css/no-shorthand-with-incomplete-longhands.html: Added.
* fast/css/remove-shorthand-expected.txt:
* fast/css/script-tests/image-set-setting.js:
(testComputedStyle):
* fast/css/uri-token-parsing-expected.txt:
* fast/css/uri-token-parsing.html:
* fast/css/webkit-mask-crash-implicit-expected.txt:
* fast/css/webkit-mask-crash-implicit.html:
* fast/dom/Element/setAttributeNode-for-existing-attribute.html:
* fast/dom/background-shorthand-csstext-expected.txt:
* fast/dom/background-shorthand-csstext.html:
* http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects-expected.txt:
* http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/cssom/cssvalue-comparison-expected.txt
LayoutTests/cssom/cssvalue-comparison.html
LayoutTests/fast/css/background-position-serialize-expected.txt
LayoutTests/fast/css/background-position-serialize.html
LayoutTests/fast/css/no-shorthand-with-incomplete-longhands-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/no-shorthand-with-incomplete-longhands.html [new file with mode: 0644]
LayoutTests/fast/css/remove-shorthand-expected.txt
LayoutTests/fast/css/script-tests/image-set-setting.js
LayoutTests/fast/css/uri-token-parsing-expected.txt
LayoutTests/fast/css/uri-token-parsing.html
LayoutTests/fast/css/webkit-mask-crash-implicit-expected.txt
LayoutTests/fast/css/webkit-mask-crash-implicit.html
LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html
LayoutTests/fast/dom/background-shorthand-csstext-expected.txt
LayoutTests/fast/dom/background-shorthand-csstext.html
LayoutTests/http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects-expected.txt
LayoutTests/http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects.html
Source/WebCore/ChangeLog
Source/WebCore/css/StyleProperties.cpp