LibWeb: Implement text-wrap-style CSS property

This commit is contained in:
Callum Law 2025-05-31 20:31:07 +12:00 committed by Sam Atkins
commit 9ba74316d2
Notes: github-actions[bot] 2025-06-04 11:49:41 +00:00
14 changed files with 140 additions and 5 deletions

View file

@ -621,6 +621,12 @@
"wrap", "wrap",
"nowrap" "nowrap"
], ],
"text-wrap-style": [
"auto",
"balance",
"stable",
"pretty"
],
"touch-action": [ "touch-action": [
"auto", "auto",
"manipulation", "manipulation",

View file

@ -90,6 +90,7 @@
"back", "back",
"background", "background",
"backwards", "backwards",
"balance",
"baseline", "baseline",
"bevel", "bevel",
"bidi-override", "bidi-override",
@ -384,6 +385,7 @@
"preserve", "preserve",
"preserve-breaks", "preserve-breaks",
"preserve-spaces", "preserve-spaces",
"pretty",
"progress", "progress",
"progress-bar", "progress-bar",
"progressive", "progressive",

View file

@ -2951,6 +2951,14 @@
"text-wrap-mode" "text-wrap-mode"
] ]
}, },
"text-wrap-style": {
"animation-type": "discrete",
"inherited": true,
"initial": "auto",
"valid-types": [
"text-wrap-style"
]
},
"top": { "top": {
"animation-type": "by-computed-value", "animation-type": "by-computed-value",
"inherited": false, "inherited": false,

View file

@ -434,7 +434,7 @@ bool pseudo_element_supports_property(PseudoElement pseudo_element, PropertyID p
append_property("text-transform"sv); append_property("text-transform"sv);
// FIXME: text-wrap // FIXME: text-wrap
append_property("text-wrap-mode"sv); append_property("text-wrap-mode"sv);
// FIXME: text-wrap-style append_property("text-wrap-style"sv);
append_property("white-space"sv); append_property("white-space"sv);
append_property("white-space-collapse"sv); append_property("white-space-collapse"sv);
append_property("white-space-trim"sv); append_property("white-space-trim"sv);

View file

@ -57,6 +57,7 @@ All properties associated with getComputedStyle(document.body):
"text-shadow", "text-shadow",
"text-transform", "text-transform",
"text-wrap-mode", "text-wrap-mode",
"text-wrap-style",
"visibility", "visibility",
"white-space-collapse", "white-space-collapse",
"word-break", "word-break",

View file

@ -619,6 +619,8 @@ All supported properties and their default values exposed from CSSStylePropertie
'text-transform': 'none' 'text-transform': 'none'
'textWrapMode': 'wrap' 'textWrapMode': 'wrap'
'text-wrap-mode': 'wrap' 'text-wrap-mode': 'wrap'
'textWrapStyle': 'auto'
'text-wrap-style': 'auto'
'top': 'auto' 'top': 'auto'
'touchAction': 'auto' 'touchAction': 'auto'
'touch-action': 'auto' 'touch-action': 'auto'

View file

@ -55,6 +55,7 @@ text-justify: auto
text-shadow: none text-shadow: none
text-transform: none text-transform: none
text-wrap-mode: wrap text-wrap-mode: wrap
text-wrap-style: auto
visibility: visible visibility: visible
white-space-collapse: collapse white-space-collapse: collapse
word-break: normal word-break: normal
@ -85,7 +86,7 @@ background-position-x: 0%
background-position-y: 0% background-position-y: 0%
background-repeat: repeat background-repeat: repeat
background-size: auto auto background-size: auto auto
block-size: 1305px block-size: 1320px
border-block-end-color: rgb(0, 0, 0) border-block-end-color: rgb(0, 0, 0)
border-block-end-style: none border-block-end-style: none
border-block-end-width: medium border-block-end-width: medium
@ -150,7 +151,7 @@ grid-row-start: auto
grid-template-areas: none grid-template-areas: none
grid-template-columns: none grid-template-columns: none
grid-template-rows: none grid-template-rows: none
height: 2280px height: 2295px
inline-size: 784px inline-size: 784px
inset-block-end: auto inset-block-end: auto
inset-block-start: auto inset-block-start: auto

View file

@ -1,8 +1,8 @@
Harness status: OK Harness status: OK
Found 200 tests Found 201 tests
190 Pass 191 Pass
10 Fail 10 Fail
Pass accent-color Pass accent-color
Pass border-collapse Pass border-collapse
@ -58,6 +58,7 @@ Pass text-indent
Pass text-justify Pass text-justify
Pass text-shadow Pass text-shadow
Pass text-transform Pass text-transform
Pass text-wrap-style
Pass visibility Pass visibility
Pass word-break Pass word-break
Pass word-spacing Pass word-spacing

View file

@ -0,0 +1,8 @@
Harness status: OK
Found 3 tests
3 Pass
Pass Property text-wrap-style value 'auto'
Pass Property text-wrap-style value 'balance'
Pass Property text-wrap-style value 'stable'

View file

@ -0,0 +1,17 @@
Harness status: OK
Found 12 tests
12 Pass
Pass e.style['text-wrap-style'] = "normal" should not set the property value
Pass e.style['text-wrap-style'] = "none" should not set the property value
Pass e.style['text-wrap-style'] = "wrap" should not set the property value
Pass e.style['text-wrap-style'] = "nowrap" should not set the property value
Pass e.style['text-wrap-style'] = "wrap wrap" should not set the property value
Pass e.style['text-wrap-style'] = "nowrap nowrap" should not set the property value
Pass e.style['text-wrap-style'] = "wrap nowrap" should not set the property value
Pass e.style['text-wrap-style'] = "pretty balance" should not set the property value
Pass e.style['text-wrap-style'] = "balance stable" should not set the property value
Pass e.style['text-wrap-style'] = "stable pretty" should not set the property value
Pass e.style['text-wrap-style'] = "delicious wrap" should not set the property value
Pass e.style['text-wrap-style'] = "5px" should not set the property value

View file

@ -0,0 +1,13 @@
Harness status: OK
Found 8 tests
8 Pass
Pass e.style['text-wrap-style'] = "auto" should set the property value
Pass e.style['text-wrap-style'] = "balance" should set the property value
Pass e.style['text-wrap-style'] = "stable" should set the property value
Pass e.style['text-wrap-style'] = "initial" should set the property value
Pass e.style['text-wrap-style'] = "inherit" should set the property value
Pass e.style['text-wrap-style'] = "unset" should set the property value
Pass e.style['text-wrap-style'] = "revert" should set the property value
Pass e.style['text-wrap-style'] = "revert-layer" should set the property value

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text: getComputedStyle().textWrapStyle</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-wrap-style">
<meta name="assert" content="text-wrap-style computed value is auto | balance | pretty | stable">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("text-wrap-style", "auto");
test_computed_value("text-wrap-style", "balance");
test_computed_value("text-wrap-style", "stable");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-wrap-style with invalid values</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-wrap-style">
<meta name="assert" content="text-wrap-style supports only the grammar '<text-wrap-style>'.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-wrap-style", "normal");
test_invalid_value("text-wrap-style", "none");
test_invalid_value("text-wrap-style", "wrap");
test_invalid_value("text-wrap-style", "nowrap");
test_invalid_value("text-wrap-style", "wrap wrap");
test_invalid_value("text-wrap-style", "nowrap nowrap");
test_invalid_value("text-wrap-style", "wrap nowrap");
test_invalid_value("text-wrap-style", "pretty balance");
test_invalid_value("text-wrap-style", "balance stable");
test_invalid_value("text-wrap-style", "stable pretty");
test_invalid_value("text-wrap-style", "delicious wrap");
test_invalid_value("text-wrap-style", "5px");
</script>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-wrap-style with valid values</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-wrap-style">
<meta name="assert" content="text-wrap-style supports the full grammar.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-wrap-style", "auto");
test_valid_value("text-wrap-style", "balance");
test_valid_value("text-wrap-style", "stable");
test_valid_value("text-wrap-style", "initial");
test_valid_value("text-wrap-style", "inherit");
test_valid_value("text-wrap-style", "unset");
test_valid_value("text-wrap-style", "revert");
test_valid_value("text-wrap-style", "revert-layer");
</script>
</body>
</html>