Keep declarative shadow templates inert

This commit is contained in:
SGavrl committed 2026-07-30 22:04:01 +00:00
1 parent 4eecbe870e
commit 6d4ce11aa1
2 files changed
+113

No files matched your search

+23
View File
@@ -6748,6 +6748,29 @@ mod tests {
);
}
#[test]
fn declarative_shadow_style_does_not_leak_into_document_cascade() {
let tree = parse_html(
r#"<style>
html, body { margin:0 }
.button { width:123px; height:20px }
</style>
<x-button>
<template shadowrootmode="open">
<style>.button { width:100% }</style>
<span class="button">shadow control</span>
</template>
</x-button>
<div id="light-button" class="button"></div>"#,
);
let laid = layout_dom(&tree, (1280.0, 720.0));
let button = tree.get_element_by_id("light-button").unwrap();
let rect = laid.rects[&button];
assert!((rect.width - 123.0).abs() < 0.1, "{rect:?}");
assert!((rect.height - 20.0).abs() < 0.1, "{rect:?}");
}
#[test]
fn multicol_balances_atomic_blocks_like_chromium() {
// Chromium 140 geometry for this reduction is a 630x300 container,