Repository navigation
webview: Clip native views without resizing the page - #3499
Conversation
|
The compatibility fix is ready in 01eab2e5 on branch Please cherry-pick the fix onto git fetch https://github.com/longbridge/gpui-kit.git fix/webview-clipping-review-3499
git cherry-pick 01eab2e5The fix restores fully visible WebViews without composition and keeps temporary geometry failures from permanently changing the caller’s visibility setting. Formatting and diff checks pass, and the WebView example builds and launches successfully on Linux. |
|
For future PRs, please submit from a fork under your personal account rather than an organization, and keep “Allow edits from maintainers” enabled. Organization-owned forks prevent me from pushing fixes directly, which makes it harder to quickly adjust the code and move the PR forward. Thanks! |
huacnlee
left a comment
There was a problem hiding this comment.
The clipping approach looks good. Please cherry-pick 01eab2e5 before merging to preserve the existing no-composition fallback and allow recovery after temporary geometry failures. The correction passes formatting and diff checks, and the WebView example builds and launches on Linux.
(cherry picked from commit 01eab2e)
When a WebView sits inside a scrolling container, its native view can extend beyond the parent's visible area and cover nearby controls. This change applies GPUI's inherited content mask to the WebView element and its mouse hitbox.
On macOS and Linux X11/XWayland, the existing native composition container follows the visible rectangle while the browser keeps its full document bounds. Scrolling clips the page without changing its layout width or height. An empty visible area hides the native view while keeping the document loaded, and hidden preparation can still give the document its actual layout width.
The implementation stays within
gpui-webview. Windows retains its existing bounds behavior; this change adds neither Windows clipping nor native Wayland support. Partial clipping on macOS and Linux requires native window composition.Review correction awaiting integration
Review found that the current PR head rejects all visible geometry without composition, including fully visible documents, then changes the caller's visibility setting to false. This breaks Linux
WebView::newand the existing composition-failure fallback, and prevents subsequent frames from recovering.The correction is available in commit 01eab2e5 on
longbridge/gpui-kit:fix/webview-clipping-review-3499. It restores the existing bounds path for fully visible documents without composition, keeps temporary native hiding separate from the caller's visibility preference, and initializes Linux display scaling before geometry updates. Unsupported partial clipping still reports an error and hides the native view; later frames can recover when clipping is no longer needed.Direct pushes to the PR's fork branch were rejected by GitHub with HTTP 403, despite the PR allowing maintainer edits. This correction still needs to be applied to
pioneerdotai/gpui-kit:fix/webview-clipping.Public API
gpui-webview
Sets the full document bounds and visible clip independently, preserving the DOM viewport while clipping through native composition. Existing
build,new,set_bounds, andset_visiblesignatures remain unchanged.Validation
cargo fmt --all --checkandgit diff --check.cargo check -p gpui-webview --lockedwas blocked while fetching the workspace'squickjs-jitdependency; an offline retry confirmed the required checkout was unavailable.AI assistance
AI assisted with the geometry implementation in
crates/webview/src/lib.rs,composition.rs, andlinux.rs, the visibility and fallback correction inlib.rs, and this description.