Fix browser view alignment at window zoom - #1244
Open
smsunarto wants to merge 1 commit into
Open
Conversation
Scale renderer-measured browser bounds by Electron's current zoom factor before sending them to the native WebContentsView. Cover both initial attachment and later bounds updates with a 125% zoom regression test.
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
Root cause
The browser panel chrome is part of the renderer and uses CSS pixel coordinates. The page is a native Electron
WebContentsView, whose bounds use window coordinates. These coordinates match at 100% window zoom but diverge after the BB shell is zoomed.The existing resize synchronization sent fresh bounds, but it repeatedly sent values in the wrong coordinate space. The native page therefore shifted left and overlapped the thread while the renderer-owned toolbar stayed in the correct right panel.
Manual bug repro
https://example.com.Before: The page layer shifts left and overlaps the thread pane. The tab strip, address bar, and other browser chrome remain correctly positioned in the right panel. Additional zoom steps increase the offset.
Expected: The page layer stays clipped below the browser toolbar and aligned with the right panel at every BB window zoom level.
Evidence
100% window zoom — control
The native page aligns with the right panel.
Increased window zoom — failure before this fix
The native page shifts left across the panel divider and covers the thread.
Verification
pnpm exec turbo run test --filter=@bb/desktop --force— 232 tests passed.pnpm exec turbo run typecheck --filter=@bb/desktop --filter=@bb/desktop-contract— passed.example.comstayed aligned with the right panel after increasing the BB shell zoom.Follow-up for #1089.