fix(core): a mover's ::before and ::after outside its box stay in the blur (#7295)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Vance Ingalls
2026-11-06 05:07:56 +00:00
committed by GitHub
co-authored by Claude Sonnet 5.5
parent b6f2bec165
commit 4bee04e4a1
4 changed files with 32 additions and 15 deletions
@@ -53,8 +53,32 @@ function growToRect(box: Box, back: Affine, r: DOMRect): void {
}
}
const POSITIONED = new Set(["absolute", "fixed"]);
const NO_CONTENT = new Set(["none", "normal"]);
function pseudoBox(el: HTMLElement, which: "::before" | "::after"): Box | null {
const cs = getComputedStyle(el, which);
if (NO_CONTENT.has(cs.content) || !POSITIONED.has(cs.position)) return null;
const left = parseFloat(cs.left) + el.clientLeft;
const top = parseFloat(cs.top) + el.clientTop;
const width = parseFloat(cs.width);
const height = parseFloat(cs.height);
if (![left, top, width, height].every(Number.isFinite)) return null;
return [left, top, left + width, top + height];
}
function growToBox(box: Box, other: Box | null): void {
if (!other) return;
box[0] = Math.min(box[0], other[0]);
box[1] = Math.min(box[1], other[1]);
box[2] = Math.max(box[2], other[2]);
box[3] = Math.max(box[3], other[3]);
}
function grownBox(el: HTMLElement, pose: Affine, scene: HTMLElement, frameW: number): Box {
const box: Box = [0, 0, el.offsetWidth, el.offsetHeight];
growToBox(box, pseudoBox(el, "::before"));
growToBox(box, pseudoBox(el, "::after"));
const back = clientToMover(pose, scene, frameW);
if (!back) return box;
const own = el.getBoundingClientRect();
@@ -105,6 +105,10 @@ const SWEEP_FIXTURES = [
name: "pseudo-after",
css: ".m::after { content: ''; position: absolute; left: 130px; top: 10px; width: 60px; height: 60px; background: #ffd166; border-radius: 50% }",
}),
sweepFixture({
name: "pseudo-before",
css: ".m::before { content: ''; position: absolute; left: -90px; top: 10px; width: 60px; height: 60px; background: #ffd166; border-radius: 50% }",
}),
// E: the mover's own clip-path.
sweepFixture({
name: "own-clip-polygon",
@@ -52,8 +52,6 @@ export const SWEEP_SYMPTOMS = {
A: 47.67,
B: 148.63,
C: 73.02,
D_CAPTURE: 107.66,
D_FILTER: 107.66,
E: 27.6,
F_CAPTURE: 40.62,
H: 135.67,
@@ -115,19 +115,10 @@ const CASES: readonly SweepCase[] = [
measuredMae: S.C,
},
},
...(["capture", "filter"] as const).map(
(tier): SweepCase => ({
fixture: "pseudo-after",
tier,
frame: 14,
check: "inside",
bug: {
finding: "D",
reason: "an ::after drawn outside the mover's box is cut off",
regions: [rect(376, 150, 72, 68)],
measuredMae: tier === "capture" ? S.D_CAPTURE : S.D_FILTER,
},
}),
...(["pseudo-after", "pseudo-before"] as const).flatMap((fixture) =>
(["capture", "filter"] as const).map(
(tier): SweepCase => ({ fixture, tier, frame: 14, check: "inside" }),
),
),
{
fixture: "own-clip-polygon",