servo/components/config
Jo Steven Novaryo f523445fc3
script: Implement DocumentOrShadowDOM.adoptedStylesheet with FrozenArray (#38163)
Spec:
https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets

Implement `DocumentOrShadowDOM.adoptedStylesheet`. Due to
`ObservableArray` being a massive issue on its own, it will be as it was
a `FrozenArray` at first. This approach is similar to how Gecko
implement adopted stylesheet. See
https://phabricator.services.mozilla.com/D144547#change-IXyOzxxFn8sU.

All of the changes will be gated behind a preference
`dom_adoptedstylesheet_enabled`.

Adopted stylesheet is implemented by adding the setter and getter of it.
While the getter works like a normal attribute getter, the setter need
to consider the inner working of document and shadow root StylesheetSet,
specifically the ordering and the invalidations. Particularly for
setter, we will clear all of the adopted stylesheet within the
StylesheetSet and readd them. Possible optimization exist, but the focus
should be directed to implementing `ObservableArray`.

More context about the implementations
https://hackmd.io/vtJAn4UyS_O0Idvk5dCO_w.

Testing: Existing WPT Coverage
Fixes: https://github.com/servo/servo/issues/37561

---------

Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
2025-07-23 08:16:01 +00:00
..
macro api: Flatten and simplify Servo preferences (#34966) 2025-01-14 13:54:06 +00:00
Cargo.toml Use new stylo crate renames (#35898) 2025-03-12 00:02:12 +00:00
lib.rs api: Flatten and simplify Servo preferences (#34966) 2025-01-14 13:54:06 +00:00
opts.rs refactor(webdriver): move webdriver_port option to servoshell pref (#37867) 2025-07-04 07:04:49 +00:00
pref_util.rs Allow setting userscripts directly without the need of files (#35388) 2025-03-27 03:00:08 +00:00
prefs.rs script: Implement DocumentOrShadowDOM.adoptedStylesheet with FrozenArray (#38163) 2025-07-23 08:16:01 +00:00