Turn white-space into a shorthand (#32146)

Bumps Stylo to servo/stylo#37

`white-space` is split into `white-space-collapse` and `text-wrap-mode`:

| white-space | white-space-collapse | text-wrap-mode |
| ----------- | -------------------- | -------------- |
| normal      | collapse             | wrap           |
| nowrap      | collapse             | nowrap         |
| pre-wrap    | preserve             | wrap           |
| pre         | preserve             | nowrap         |
| pre-line    | preserve-breaks      | wrap           |
| -           | preserve-breaks      | nowrap         |

Note this introduces a combination that wasn't previously possible,
but I think the existing logic can handle it well enough.

The old `allow_wrap()` is replaced by checking whether `text-wrap-mode`
is set to `wrap`.

The old `preserve_newlines()` is replaced by checking whether
`white-space-collapse` is *not* set to `collapse`.

The old `preserve_spaces()` is replaced by checking whether
`white-space-collapse` is set to `preserve`.
This commit is contained in:
Oriol Brufau 2024-04-29 12:40:44 +02:00 committed by GitHub
parent a1f8c19355
commit d490fdf83c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 141 additions and 454 deletions

View file

@ -35,18 +35,6 @@
[Property text-wrap inherits]
expected: FAIL
[Property white-space-collapse has initial value collapse]
expected: FAIL
[Property white-space-collapse inherits]
expected: FAIL
[Property text-wrap-mode has initial value wrap]
expected: FAIL
[Property text-wrap-mode inherits]
expected: FAIL
[Property text-wrap-style has initial value auto]
expected: FAIL

View file

@ -1,6 +0,0 @@
[text-wrap-mode-computed.html]
[Property text-wrap-mode value 'wrap']
expected: FAIL
[Property text-wrap-mode value 'nowrap']
expected: FAIL

View file

@ -1,21 +0,0 @@
[text-wrap-mode-valid.html]
[e.style['text-wrap-mode'\] = "wrap" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "nowrap" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "initial" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "inherit" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "unset" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "revert" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "revert-layer" should set the property value]
expected: FAIL

View file

@ -1,12 +1,3 @@
[white-space-collapse-computed.html]
[Property white-space-collapse value 'collapse']
expected: FAIL
[Property white-space-collapse value 'preserve']
expected: FAIL
[Property white-space-collapse value 'preserve-breaks']
expected: FAIL
[Property white-space-collapse value 'break-spaces']
expected: FAIL

View file

@ -1,27 +1,3 @@
[white-space-collapse-valid.html]
[e.style['white-space-collapse'\] = "collapse" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "preserve" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "preserve-breaks" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "break-spaces" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "initial" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "inherit" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "unset" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "revert" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "revert-layer" should set the property value]
expected: FAIL

View file

@ -1,70 +1,4 @@
[white-space-shorthand.html]
[e.style['white-space'\] = "collapse" should set the property value]
expected: FAIL
[Property white-space value 'collapse']
expected: FAIL
[e.style['white-space'\] = "wrap" should set the property value]
expected: FAIL
[Property white-space value 'wrap']
expected: FAIL
[e.style['white-space'\] = "collapse wrap" should set the property value]
expected: FAIL
[Property white-space value 'collapse wrap']
expected: FAIL
[e.style['white-space'\] = "wrap collapse" should set the property value]
expected: FAIL
[Property white-space value 'wrap collapse']
expected: FAIL
[e.style['white-space'\] = "preserve nowrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap preserve" should set the property value]
expected: FAIL
[Property white-space value 'nowrap preserve']
expected: FAIL
[e.style['white-space'\] = "collapse nowrap" should set the property value]
expected: FAIL
[Property white-space value 'collapse nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap collapse" should set the property value]
expected: FAIL
[Property white-space value 'nowrap collapse']
expected: FAIL
[e.style['white-space'\] = "preserve" should set the property value]
expected: FAIL
[Property white-space value 'preserve']
expected: FAIL
[e.style['white-space'\] = "preserve wrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve wrap']
expected: FAIL
[e.style['white-space'\] = "wrap preserve" should set the property value]
expected: FAIL
[Property white-space value 'wrap preserve']
expected: FAIL
[e.style['white-space'\] = "break-spaces" should set the property value]
expected: FAIL
@ -83,36 +17,6 @@
[Property white-space value 'wrap break-spaces']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks wrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks wrap']
expected: FAIL
[e.style['white-space'\] = "wrap preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'wrap preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks nowrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'nowrap preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "balance" should set the property value]
expected: FAIL

View file

@ -1,2 +0,0 @@
[white-space-collapse-preserve-breaks-001.xht]
expected: FAIL

View file

@ -53,18 +53,6 @@
[Property word-wrap inherits]
expected: FAIL
[Property white-space-collapse has initial value collapse]
expected: FAIL
[Property white-space-collapse inherits]
expected: FAIL
[Property text-wrap-mode has initial value wrap]
expected: FAIL
[Property text-wrap-mode inherits]
expected: FAIL
[Property text-wrap-style has initial value auto]
expected: FAIL

View file

@ -1,6 +0,0 @@
[text-wrap-mode-computed.html]
[Property text-wrap-mode value 'wrap']
expected: FAIL
[Property text-wrap-mode value 'nowrap']
expected: FAIL

View file

@ -1,21 +0,0 @@
[text-wrap-mode-valid.html]
[e.style['text-wrap-mode'\] = "wrap" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "nowrap" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "initial" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "inherit" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "unset" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "revert" should set the property value]
expected: FAIL
[e.style['text-wrap-mode'\] = "revert-layer" should set the property value]
expected: FAIL

View file

@ -1,12 +1,3 @@
[white-space-collapse-computed.html]
[Property white-space-collapse value 'collapse']
expected: FAIL
[Property white-space-collapse value 'preserve']
expected: FAIL
[Property white-space-collapse value 'preserve-breaks']
expected: FAIL
[Property white-space-collapse value 'break-spaces']
expected: FAIL

View file

@ -1,27 +1,3 @@
[white-space-collapse-valid.html]
[e.style['white-space-collapse'\] = "collapse" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "preserve" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "preserve-breaks" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "break-spaces" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "initial" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "inherit" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "unset" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "revert" should set the property value]
expected: FAIL
[e.style['white-space-collapse'\] = "revert-layer" should set the property value]
expected: FAIL

View file

@ -1,70 +1,4 @@
[white-space-shorthand.html]
[e.style['white-space'\] = "collapse" should set the property value]
expected: FAIL
[Property white-space value 'collapse']
expected: FAIL
[e.style['white-space'\] = "wrap" should set the property value]
expected: FAIL
[Property white-space value 'wrap']
expected: FAIL
[e.style['white-space'\] = "collapse wrap" should set the property value]
expected: FAIL
[Property white-space value 'collapse wrap']
expected: FAIL
[e.style['white-space'\] = "wrap collapse" should set the property value]
expected: FAIL
[Property white-space value 'wrap collapse']
expected: FAIL
[e.style['white-space'\] = "preserve nowrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap preserve" should set the property value]
expected: FAIL
[Property white-space value 'nowrap preserve']
expected: FAIL
[e.style['white-space'\] = "collapse nowrap" should set the property value]
expected: FAIL
[Property white-space value 'collapse nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap collapse" should set the property value]
expected: FAIL
[Property white-space value 'nowrap collapse']
expected: FAIL
[e.style['white-space'\] = "preserve" should set the property value]
expected: FAIL
[Property white-space value 'preserve']
expected: FAIL
[e.style['white-space'\] = "preserve wrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve wrap']
expected: FAIL
[e.style['white-space'\] = "wrap preserve" should set the property value]
expected: FAIL
[Property white-space value 'wrap preserve']
expected: FAIL
[e.style['white-space'\] = "break-spaces" should set the property value]
expected: FAIL
@ -83,36 +17,6 @@
[Property white-space value 'wrap break-spaces']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks wrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks wrap']
expected: FAIL
[e.style['white-space'\] = "wrap preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'wrap preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "preserve-breaks nowrap" should set the property value]
expected: FAIL
[Property white-space value 'preserve-breaks nowrap']
expected: FAIL
[e.style['white-space'\] = "nowrap preserve-breaks" should set the property value]
expected: FAIL
[Property white-space value 'nowrap preserve-breaks']
expected: FAIL
[e.style['white-space'\] = "balance" should set the property value]
expected: FAIL