cssText should use shorthand notations
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 23:59:27 +0000 (23:59 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 23:59:27 +0000 (23:59 +0000)
commita7ea109a27c2d13e6ed28aa83d720067d650845e
tree3aff9e6e2a4e95bacd13ce3f14bfc1fb54c9bc0b
parentbbc986d226c0cdfa98027346734b30a5916bf2fb
cssText should use shorthand notations
https://bugs.webkit.org/show_bug.cgi?id=81737

Reviewed by Enrica Casucci.

Source/JavaScriptCore:

Export symbols of BitVector on Windows.

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:

Source/WebCore:

Use shorthand properties to serialize style properties for cssText.

The overall algorithm is to look for any property that has a shorthand, and then check if
the shorthand value could be obtained (the condition is quite complicated for border properties).
If it could, then append that value to the string builder, and set the corresponding entries in
shorthandPropertyAppeared and shorthandPropertyUsed. If not, only turn on the bit in
shorthandPropertyAppeared on to avoid calling getPropertyValue again for longhand properties
that use the same shorthand property when we cannot use the shorthand.

Test: fast/css/cssText-shorthand.html

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::asText):

Source/WTF:

* wtf/BitVector.h:
(BitVector):
(WTF::BitVector::ensureSizeAndSet): Added.

LayoutTests:

Rebaseline existing tests and add a regression test for unprefixed CSS properties with
the exception of -webkit-border-horizontal/vertical-spacing (the shorthand version of
these properties (border-spacing) is unprefixed.

* editing/pasteboard/paste-and-sanitize-expected.txt: Uses border instead of longhand
properties as desired.
* editing/pasteboard/paste-and-sanitize.html:
* editing/style/non-inheritable-styles-expected.txt: Ditto.
* fast/css/background-position-serialize-expected.txt: No longer emits "background-*:
initial" as desired.
* fast/css/cssText-shorthand-expected.txt: Added.
* fast/css/cssText-shorthand.html: Added.
* fast/css/remove-shorthand-expected.txt:
* fast/css/remove-shorthand.html: Modified to do elaborative comparison of the lists of
properties before and after removing a shorthand since now removing a shorthand property
may end up adding new longhand property.
* fast/css/uri-token-parsing-expected.txt:
* fast/css/uri-token-parsing.html: Uses shorthand properties instead of longhand equivalents.
* inspector/styles/styles-update-from-js-expected.txt: Ditto.
* printing/page-rule-css-text-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/paste-and-sanitize-expected.txt
LayoutTests/editing/pasteboard/paste-and-sanitize.html
LayoutTests/editing/style/non-inheritable-styles-expected.txt
LayoutTests/fast/css/background-position-serialize-expected.txt
LayoutTests/fast/css/cssText-shorthand-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/cssText-shorthand.html [new file with mode: 0644]
LayoutTests/fast/css/remove-shorthand-expected.txt
LayoutTests/fast/css/remove-shorthand.html
LayoutTests/fast/css/uri-token-parsing-expected.txt
LayoutTests/fast/css/uri-token-parsing.html
LayoutTests/inspector/styles/styles-update-from-js-expected.txt
LayoutTests/printing/page-rule-css-text-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/WTF/ChangeLog
Source/WTF/wtf/BitVector.h
Source/WebCore/ChangeLog
Source/WebCore/css/StylePropertySet.cpp