Repository navigation
Conversation
Lightning00Blade
self-requested a review
December 3, 2026 13:21
Collaborator
|
Thanks for the fix! A couple of edge cases and inconsistencies to address before merging: 1. Unconditional scrolling before checking whether downscaling is needed (
|
Collaborator
|
Closing due to #3648 |
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.
Summary
take_screenshotwith auidcan capture the wrong region when a size limit downscales the image and the target is hidden inside a scrolling container. The downscale path measures the element before scrolling and gives that clip topage.screenshot(). Capturing beyond the viewport cannot reveal content clipped by an inneroverflow: autocontainer.Related to #2684 and #2685, which corrected the window scroll offsets used in the screenshot clip.
Changes
--screenshotMaxWidthor--screenshotMaxHeightset, scroll the target into view before measuring its bounding box and the window scroll offsets. This can move the window or an inner scroll container, even when the element fits within the limit. If no downscale clip is needed, capture withelement.screenshot().Testing
mainbecause the handler measures the box without scrolling. It passes with the fix.overflow: autocontainer. Each limit produced an 80 × 40 PNG. The center pixel changed from the red page background onmainto the green target with the fix. The uncapped capture and the capture that fit within the limit both returned the green target at 160 × 80 on each revision.npm run build, the unfilterednpm run test:no-build -- --test-concurrency=2passed with 2,365 passes, four skips, zero failures and zero cancellations (Node 24.11.1, Chrome for Testing 157).tests/tools/screenshot.test.tspasses with one pre-existingomitBackgroundtest excluded. That test gets18,18,18where it expects255,255,255on both revisions.npm run format,npm run check-format, andnpm run genpass without changes to tracked files.🤖 Generated with Claude Code