ladybird/Tests/LibWeb/Text/input/content-blocker-shadow-pseudo-class-invalidation.html
Andreas Kling 817cb7432f LibWeb: Keep shadow rule caches for user styles
Do not invalidate shadow-root rule caches when the document user style
sheet changes. Shadow trees still need style invalidation because
document user rules can match their descendants, but their local author
rule caches do not include the document user sheet.

Since user and content-blocker sheets now live only in the document
scope, shadow-DOM state changes also have to consult the document user
selector insights for :has() and pseudo-class invalidation.

Add content blocker coverage for user-style refreshes, shadow :has()
state changes, and shadow pseudo-class invalidation.
2026-05-23 22:03:46 +02:00

29 lines
1 KiB
HTML

<!DOCTYPE html>
<script src="./include.js"></script>
<body></body>
<script>
asyncTest(done => {
spoofCurrentURL("https://example.com/content-blocker-shadow-pseudo-class-invalidation.html");
internals.setContentBlockers("example.com##span:hover");
const host = document.createElement("section");
const shadowRoot = host.attachShadow({ mode: "open" });
document.body.appendChild(host);
const target = document.createElement("span");
target.style.cssText = "display: block; width: 100px; height: 100px";
shadowRoot.appendChild(target);
println(`hover before: ${getComputedStyle(target).display}`);
const rect = target.getBoundingClientRect();
internals.mouseMove(rect.left + 5, rect.top + 5);
println(`hover after enter: ${getComputedStyle(target).display}`);
internals.mouseMove(200, 200);
println(`hover after leave: ${getComputedStyle(target).display}`);
internals.setContentBlockers("");
done();
});
</script>