oficina / docs Public

first-reveal: clip from where the sheet is drawn, and hold its left edge

The capture was fixed at x 225, y 200 for a sheet centred at 1280px
under two strips of chrome. Under I2 the inspector sits beside the sheet
(which moves left only as far as it must) and the sheet starts under the
header, so the clip caught the inspector's controls enabling and missed
the sheet's first lines (the drop scenario's text). The clip is now taken
once from the sheet's own box, and a sheet that moves sideways after it
is caught by its left edge, seen to fail by a script that opened the
inspector 400ms after load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 0d2e8f8f949bae0520b422df9d2f5c18a650d55b parent fa8ae82
1 file changed, +22 −4
  • fixtures/engines/first-reveal.mjs +22 −4

CI passed — run details

diff --git a/fixtures/engines/first-reveal.mjs b/fixtures/engines/first-reveal.mjs
index 26bf00e..4f636a8 100644
--- a/fixtures/engines/first-reveal.mjs
+++ b/fixtures/engines/first-reveal.mjs
@@ -167,8 +167,8 @@ function verdict(frames) {
if (last.blank) return `the sheet was blank at the end (${last.ms}ms)`
for (const f of frames.slice(text)) {
if (f.blank) return `text was on screen at ${frames[text].ms}ms, then gone at ${f.ms}ms`
- if (f.hash !== last.hash || f.gaps !== last.gaps || f.height !== last.height) {
- return `at ${f.ms}ms ${f.gaps} page gaps, ${f.height}px, ${f.hash.slice(0, 8)}; finally ${last.gaps}, ${last.height}px, ${last.hash.slice(0, 8)}`
+ if (f.hash !== last.hash || f.gaps !== last.gaps || f.height !== last.height || f.left !== last.left) {
+ return `at ${f.ms}ms ${f.gaps} page gaps, ${f.height}px at x ${f.left}, ${f.hash.slice(0, 8)}; finally ${last.gaps}, ${last.height}px at x ${last.left}, ${last.hash.slice(0, 8)}`
}
}
return null
@@ -217,6 +217,7 @@ for (const [engineName, engine] of Object.entries({ chromium, webkit }).filter((
}
const start = Date.now()
let acted = false
+ let clip = null
while (Date.now() - start < (s.length || (s.editorDelay || 0) + 3500)) {
if (s.action && !acted && before) {
await page.evaluate(ACTIONS[s.action])
@@ -229,6 +230,8 @@ for (const [engineName, engine] of Object.entries({ chromium, webkit }).filter((
visible: getComputedStyle(sheet).visibility === 'visible',
gaps: document.querySelectorAll('[docs-page-gap]').length,
height: Math.round(sheet.getBoundingClientRect().height * 4) / 4,
+ left: Math.round(sheet.getBoundingClientRect().left * 4) / 4,
+ top: sheet.getBoundingClientRect().top,
busy: ['loading', 'refused'].includes((document.querySelector('[docs-fonts-status]') || { getAttribute: () => '' }).getAttribute('data-state')),
} : null
}).catch(() => null)
@@ -242,7 +245,22 @@ for (const [engineName, engine] of Object.entries({ chromium, webkit }).filter((
// its @font-face set on each, reporting a loaded face as unloaded
// until it is next used, which the probe then saw as a violation
// (branch review 7's WebKit failure).
- const raw = await page.screenshot({ clip: { x: 225, y: 200, width: 830, height: 1150 }, caret: 'hide', timeout: 2000 }).catch(() => null)
+ // Across from 7px before the sheet's first left edge, 830px: the
+ // sheet and a little desk either side, and never the inspector,
+ // which floats beside the sheet from 64rem (spec I2) and whose
+ // controls change, as chrome, when the editor mounts. Down from
+ // half an inch into the sheet's top margin, under a two-line font
+ // note, to the viewport's foot. The sheet is not centred at this
+ // width while the inspector is open, and starts under the header
+ // now the menus are in it, so the clip is taken from where the
+ // sheet is drawn, once; a sheet that then moves sideways is caught
+ // by its left edge (verdict), and one that moves down by the
+ // picture.
+ if (clip === null) {
+ const y = Math.max(0, Math.floor(state.top) + 48)
+ clip = { x: Math.max(0, Math.floor(state.left) - 7), y, width: 830, height: Math.min(1150, 1400 - y) }
+ }
+ const raw = await page.screenshot({ clip, caret: 'hide', timeout: 2000 }).catch(() => null)
if (!raw) continue
const shot = PNG.sync.read(raw)
let ink = 0
@@ -261,7 +279,7 @@ for (const [engineName, engine] of Object.entries({ chromium, webkit }).filter((
// Blank: hidden, no ink at all, or nothing but ink (a capture
// taken before anything was drawn).
const blank = !state.visible || ink === 0 || light === 0
- const frame = { ms, blank, hash: createHash('sha256').update(shot.data).digest('hex'), ink: createHash('sha256').update(mask).digest('hex'), gaps: state.gaps, height: state.height, busy: state.busy, afterAction: acted }
+ const frame = { ms, blank, hash: createHash('sha256').update(shot.data).digest('hex'), ink: createHash('sha256').update(mask).digest('hex'), gaps: state.gaps, height: state.height, left: state.left, busy: state.busy, afterAction: acted }
if (s.action && !acted && !blank) before = frame
frames.push(frame)
}