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