fix(shell): clip native_surface overlay to its panel's corner radius
The web canvas is a GPUI `native_surface` element, which on macOS attaches an `NSView` (with a Metal-backed `CALayer`) as an AppKit overlay on top of the GPUI render layer. GPUI's `overflow: hidden` clips its own children but cannot reach into AppKit, so the canvas painted square corners on top of the main panel's rounded edge — the white surface visibly overshot the panel's rounded bottom. Thread a per-corner radius through the GPUI patch: - `Window::sync_native_surface` and the `PlatformWindow` trait carry a `Corners<Pixels>`. - The macOS implementation sets `CALayer.cornerRadius` to the maximum requested radius and `maskedCorners` to the bitmask of corners that actually requested rounding (GPUI is Y-down while NSView is Y-up, so a GPUI "top" maps to a CALayer "MaxY" corner — comment locks the mapping). `setMasksToBounds: YES` lets Core Animation actually honor the corner radius for layered content. - The `NativeSurface` element resolves all four corner radii from its own `StyleRefinement` (so callers attach `.rounded_bl(...)` / `.rounded_br(...)` exactly as on any other GPUI element). Application side wires the right radius per context: - The main canvas asks for `RADIUS_CARD` (18 px) on its bottom corners so it follows the surrounding panel's rounded bottom edge while the top stays flush against the toolbar. - A split pane's canvas asks for the pane's own `SPLIT_PANE_RADIUS` (10 px) so the canvas hugs the rounded frame the pane already paints. `render_failed_web_surface` doesn't need rounding wiring — the error page is a GPUI div and is clipped normally by the surrounding `overflow: hidden`.
This commit is contained in:
Vendored
+7
-1
@@ -747,7 +747,13 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
|
||||
fn create_native_surface(&self) -> Option<NativeSurfaceHandle> {
|
||||
None
|
||||
}
|
||||
fn sync_native_surface(&self, _surface: &NativeSurfaceHandle, _bounds: Bounds<Pixels>) {}
|
||||
fn sync_native_surface(
|
||||
&self,
|
||||
_surface: &NativeSurfaceHandle,
|
||||
_bounds: Bounds<Pixels>,
|
||||
_corner_radii: crate::Corners<Pixels>,
|
||||
) {
|
||||
}
|
||||
|
||||
// macOS specific methods
|
||||
fn get_title(&self) -> String {
|
||||
|
||||
Reference in New Issue
Block a user