Support ::part selector (#37307)

This is pretty much just wiring up the necessary stylo methods. Note
that the `exportparts` attribute is not yet supported, I'll do that in a
followup change

Testing: Covered by existing web platform tests.
This is the first half of https://github.com/servo/servo/issues/35349

Fixes https://github.com/servo/servo/issues/37325

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-06-09 12:17:28 +02:00 committed by GitHub
parent 73ee36be00
commit 0fa3de3937
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 119 additions and 348 deletions

View file

@ -1,13 +1,4 @@
[pseudo-elements-after-part.html]
["::part(mypart)::after" should be a valid selector]
expected: FAIL
["::part(mypart)::backdrop" should be a valid selector]
expected: FAIL
["::part(mypart)::before" should be a valid selector]
expected: FAIL
["::part(mypart)::cue" should be a valid selector]
expected: FAIL
@ -29,18 +20,12 @@
["::part(mypart)::highlight(myhighlight)" should be a valid selector]
expected: FAIL
["::part(mypart)::marker" should be a valid selector]
expected: FAIL
["::part(mypart)::placeholder" should be a valid selector]
expected: FAIL
["::part(mypart)::search-text" should be a valid selector]
expected: FAIL
["::part(mypart)::selection" should be a valid selector]
expected: FAIL
["::part(mypart)::spelling-error" should be a valid selector]
expected: FAIL
@ -95,21 +80,12 @@
[computed style for ::part()::search-text]
expected: FAIL
[computed style for ::part()::selection]
expected: FAIL
[computed style for ::part()::spelling-error]
expected: FAIL
[computed style for ::part()::target-text]
expected: FAIL
[::part styles with ::part(mypart)::after {\n display: block;\n content: "";\n height: 77px;\n } and <div part='mypart'></div>]
expected: FAIL
[::part styles with ::part(mypart)::before {\n display: block;\n content: "";\n height: 46px;\n } and <div part='mypart'></div>]
expected: FAIL
[::part styles with ::part(mypart)::details-content {\n height: 371px;\n } and <details part='mypart'><summary style="height:47px">summary</summary>details</details>]
expected: FAIL
@ -121,6 +97,3 @@
[::part styles with ::part(mypart) {\n font: 20px/1 Ahem;\n }\n ::part(mypart)::first-line {\n font-size: 86px;\n } and <div part=mypart>X<br>X</div>]
expected: FAIL
[::part styles with ::part(mypart)::marker {\n font: 63px/1.0 Ahem;\n content: "X";\n } and <li style="list-style-position: inside" part="mypart"></li>]
expected: FAIL