fix(css): enable starting-style parsing

This commit is contained in:
ldm0
2026-09-08 02:00:31 +08:00
parent 9130ebd75b
commit 79c63809e3
2 changed files with 22 additions and 0 deletions
@@ -777,6 +777,27 @@ fn grouping_rule_css_text_uses_stylo_rule_view_serialization() {
);
}
#[test]
fn starting_style_rule_accepts_an_empty_prelude_and_rejects_nonempty_preludes() {
crate::style_engine::ensure_stylo_browser_compat_prefs();
assert_eq!(
parsed_top_level_rule_texts("@starting-style {}"),
["@starting-style {\n}"]
);
for css_text in [
"@starting-style div {}",
"@starting-style () {}",
"@starting-style ( {}",
"@starting-style }{}",
] {
assert!(
parsed_top_level_rule_texts(css_text).is_empty(),
"unexpectedly accepted {css_text:?}"
);
}
}
#[test]
fn grouping_rule_css_text_uses_stylo_page_rule_child_serialization() {
let css_text =
+1
View File
@@ -1119,6 +1119,7 @@ pub(crate) fn ensure_stylo_browser_compat_prefs() {
stylo_static_prefs::set_pref!("layout.css.content.alt-text.enabled", true);
stylo_static_prefs::set_pref!("layout.css.margin-rules.enabled", true);
stylo_static_prefs::set_pref!("layout.css.scroll-driven-animations.enabled", true);
stylo_static_prefs::set_pref!("layout.css.starting-style-at-rules.enabled", true);
stylo_static_prefs::set_pref!("layout.css.style-queries.enabled", true);
stylo_static_prefs::set_pref!("layout.css.tree-counting-functions.enabled", true);
stylo_static_prefs::set_pref!("layout.css.zoom.enabled", true);