Repository navigation
webview: Clip partially visible WebViews on Windows - #4066
Merged
huacnlee merged 1 commit intoNov 22, 2026
Merged
Conversation
huacnlee
reviewed
Nov 21, 2026
huacnlee
left a comment
Member
There was a problem hiding this comment.
💡 Fix looks correct, but it is Windows-only and unverified here: needs green Windows CI (workflows awaiting approval) before merging.
Reviewed at b83c19f.
SetWindowRgnon Wry's child HWND, computed in device pixels fromGetDpiForWindow, keeps the full WebView2 viewport so the page doesn't reflow; the region is cleared when fully visible or on directset_bounds. Good follow-up to #3499.- Adds a direct
windows0.61 dependency for the webview crate on Windows only; that version is already inCargo.lock, so no new crate is pulled in. - No public API change; only the
WebViewdocs are updated. - Could not compile or run on Windows from this host.
huacnlee
approved these changes
Nov 22, 2026
huacnlee
enabled auto-merge (squash)
November 22, 2026 00:18
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.
Description
Follow-up to #3499. On Windows, a WebView inside a scrolling container can extend past the visible area and cover nearby controls.
Apply the inherited clip to Wry's child window with
SetWindowRgn, while keeping the full WebView2 viewport so clipping doesn't reflow the page. Calculate the window bounds and clip in device pixels using the child window's DPI. Clear the region when the WebView is fully visible again or whenset_boundsis called directly.This doesn't change GPUI overlay ordering above WebView2.
How to Test
cargo test -p gpui-webview --locked. The new test covers clip rounding at 125% scaling and checks that a fully visible WebView needs no region.