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.
29 lines
1 KiB
HTML
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>
|