feat: solver consumes CSS contain:paint for clippedBy diagnostics

- Add Contain=5 to geometry world ClipKind enum (avoids collision with
  topology engine's CONTAIN=3 vs Mask=3)
- Fix CDP isClippingElement() to detect contain:paint (style.contain)
- CDP topology builder sets clipKind=5 for contain:paint, 1 for overflow
- Enrich clippedByPredicate with clipKind metric:
  1=contain:paint, 2=overflow (hidden/scroll/auto)
- Reads world.clipping.clipKind of the reference's clip node
This commit is contained in:
John Dvorak
2026-05-21 13:52:28 -07:00
parent a75c3be9e0
commit c4a3d304ef
3 changed files with 18 additions and 2 deletions
+4 -1
View File
@@ -156,6 +156,7 @@ export async function extractTopology(
function isClippingElement(el) {
const style = window.getComputedStyle(el)
if (style.contain && style.contain.includes('paint')) return true
return style.overflowX === 'hidden' || style.overflowX === 'scroll' || style.overflowX === 'auto' ||
style.overflowY === 'hidden' || style.overflowY === 'scroll' || style.overflowY === 'auto' ||
style.clipPath !== 'none'
@@ -252,10 +253,12 @@ export async function extractTopology(
if (isClippingElement(el)) {
const r = rectFor(el)
const style = window.getComputedStyle(el)
const isContainPaint = style.contain && style.contain.includes('paint')
results.clipping.push({
clipNodeId: results.clipping.length,
subjectId,
clipKind: 1,
clipKind: isContainPaint ? 5 : 1,
clipLeft: r.left,
clipTop: r.top,
clipRight: r.right,