Repository navigation
feat(browser): the owner sees the page as sharp as their screen, and quicker in their hands - #167
Merged
Merged
Conversation
…quicker in their hands The bot's page was drawn at one pixel per page pixel and sent at ~15 frames a second, so on a scaled screen its text was blurry and scrolling felt slow. The app now sends its devicePixelRatio with browser.resize, and the page is drawn that sharp (deviceScaleFactor, up to 2x) for the owner. The screencast keeps the page's own pixels whatever the scale (checked with the real Edge, spec 19), so on a sharper screen its small frames only say the page changed and the frame sent is a screenshot, confirmed after it so they never pile up. Frames come ~30 a second while the owner has the browser in their hands, ~15 while they watch the bot. The bot's own screenshots stay the size of the page: clipped where the page is scrolled to and scaled back down, so they cost the bot the same.
httpsphl
enabled auto-merge
October 4, 2026 20:50
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.
Why
The owner found the bot's live page blurry when full screen, and slow. Both came from saving resources:
What
browser.resizetakes an optionalscale: the app'sdevicePixelRatio× 100. The page is drawn that sharp withdeviceScaleFactor, up to 2×. Its size in CSS pixels does not change.Page.captureScreenshot(JPEG, quality 60,optimizeForSpeed).browser_screenshot) stay the size of the page, so they cost the bot the same tokens. They are clipped where the page is scrolled to (Page.getLayoutMetrics→cssVisualViewport.pageX/pageY) and scaled back down (clip.scale).Checks
cargo fmt,clippy -D warnings,cargo test --workspaceandpnpm checkpass.browser_panel.rs:scale200 the page reportsdevicePixelRatio2;#endis 1000×700.Manual check on the real app