From 65cb048b1bf355e1501213784245511ac9a3f8bc Mon Sep 17 00:00:00 2001 From: daboe01 Date: Fri, 3 Apr 2026 17:40:45 +0200 Subject: [PATCH] Fixed: incorrect CPWebView sizing after animation --- AppKit/CPWebView.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AppKit/CPWebView.j b/AppKit/CPWebView.j index f39d9ee40..35a65860e 100644 --- a/AppKit/CPWebView.j +++ b/AppKit/CPWebView.j @@ -278,7 +278,11 @@ CPWebViewAppKitScrollMaxPollCount = 3; if (_effectiveScrollMode === CPWebViewScrollAppKit) { - var visibleRect = [_frameView visibleRect]; + // Use `[_scrollView documentVisibleRect]` instead of `[_frameView visibleRect]`. + // `visibleRect` accounts for window clipping, which collapses to 0x0 if the view is + // animated off-screen, resulting in an incorrectly shrunken web layout. + var visibleRect = [_scrollView documentVisibleRect]; + [_frameView setFrameSize:CGSizeMake(CGRectGetMaxX(visibleRect), CGRectGetMaxY(visibleRect))]; // try to get the document size so we can correctly set the frame