Repository navigation
Capture: hold animated images and SVG animations on their first frame - #64
Merged
Merged
Conversation
A Blink launch setting (imageAnimationPolicy=2) on both launch paths. It replaces Playwright's own headless --blink-settings, so the hover/pointer values are repeated. The animated fixture gains a GIF and a SMIL fill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tmashara
force-pushed
the
claude/issue-42-freeze-images
branch
from
October 29, 2026 16:15
f752304 to
0e69233
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Animated images (GIF, APNG, animated WebP) and SVG animations (SMIL, inline or as
<img>) now show their first frame on both sides.launch()insrc/run.tspasses--blink-settings=imageAnimationPolicy=2on the bundled Chromium and the system Chrome fallback. The report's "What was neutralized" block, README,docs/how-it-works.mdand the skill reference say so.Why
reducedMotionand the fake clock stop none of these, so a page with a GIF either scored unstable pixels or diffed on whichever frame each side landed on. Checked on Chromium 151 headless shell and system Chrome 156: with policy 2, GIF/APNG/WebP, a play-once GIF, a CSSbackground-imageGIF, SVG-in-<img>, inline SMIL and a GIF inserted after load all hold frame 0. The policy is renderer-wide from launch, so an image never starts animating. Policy 1 (animate once) is wrong: play-once images end on the last frame.Not the issue's canvas/data-URL approach:
drawImageof a cross-origin image taints the canvas sotoDataURLthrows (most sites serve images from CDNs), it misses CSS backgrounds and SMIL, and it changes the DOM that--computedreads. Apage.routerewrite would bypassrouteFromHAR(--cache-right).Scrollbars: no change
The issue assumes scrollbars show up, for example on the installed-Chrome fallback. They don't: Playwright adds
--hide-scrollbarswhenever it launches headless, and renderdiff always launches headless, the Chrome fallback included. Anoverflow: scrollbox measuresoffsetWidth - clientWidth == 0on both paths with no args of ours. Passing the flag ourselves would only repeat it.The repeated blink-settings (fragile on purpose)
Our
--blink-settingsreplaces the one Playwright passes in headless mode (primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4), because Chromium uses the last value of a repeated switch. Those values are what make Linux CI (no pointer device) report(hover: hover)/(pointer: fine), so ours repeats them. I found no better way: Playwright has no publicdefaultArgs(that's Puppeteer),ignoreDefaultArgsneeds the same exact string, and CDPBrowser.getBrowserCommandLineis refused without--enable-automation. If Playwright changes its values, ours win silently, but both sides share the browser, so the comparison stays symmetric. A one-line comment says why the values are there. Linux CI is the real check for them, since a Mac reports hover/fine even without them.Behaviour change
Pages with animated images now capture frame 0. Accepted diffs or
--rerun-failedstate recorded on another frame may not match.Tests
animatedfixture (identical on both sides) gains a 4-frame GIF (tests/fixtures/shared/img/blink.gif, 417 bytes,base.csscolours) and an inline SVG whose SMIL fill interpolates continuously. The SVG makes the check deterministic: with only the GIF, the two stability shots sometimes land on the same frame. The fixture server serves.gif.tests/visual/guardrails.test.tsis the test that catches a regression. Without the flag it failed 3 runs out of 3 (unstablePixels8192, both 64x64 boxes). With the flag it passed 3 out of 3. The "identical" diff test can't see this, because unstable pixels are left out of the diff.npm test(294 pass) andnpm run test:visual(330 pass, rebased on Capture: name a route that is not an HTML page #63) all pass on macOS.Fixes #42
🤖 Generated with Claude Code