Files
Zhifei Li ae809153b5 fix(render): measure page height from content, not the body box (#131)
pixelshot clamped the page height to `body.getBoundingClientRect().bottom`,
which only bounds the document when the page lets the body size to its
content. Sites that pin it to the viewport — `html, body { height: 100% }`,
as Wikipedia's Vector 2022 skin does — leave the content overflowing a
one-viewport box, so a 19,951px article measured 1,568px and captured a
single tile with `complete: true` (issue #124).

The rect was also read as a document coordinate while being
viewport-relative. A URL with a `#fragment` loads already scrolled, where
the bottom edge is negative and `Math.max(bottom, 1)` floors the whole page
to 1px.

Measure the lowest edge among the body and its element children instead, and
add the scroll offset back. That reads the same as before on a self-sizing
body, so the clamp still drops the blank tail an inflated
`documentElement.scrollHeight` would otherwise buy (root padding, trailing
margin), while surviving a pinned body.

Both capture paths carried their own copy of the probe; the snippet now
lives in one module so they can't drift apart.

Verified in stock Chrome, standard and turbo probes agreeing on every page:

    page                  before    after   scrollHeight
    wikipedia (#124)        1568    19951          19951
    wikipedia #fragment        1    19951          19951
    simonwillison.net      18252    18252          18252
    ourworldindata.org      8713     8713           8713

Closes #124
2026-07-31 16:43:37 +08:00
..