Skip to content

Commit

Permalink
Adjust the corner radius of fullscreen windows
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246482
rdar://97042030

Reviewed by Devin Rousso.

* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController viewIsAppearing:]):

Use `viewIsAppearing` to ensure that the view controller's view has been added
to a window.

* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController enterFullScreen:]):

Canonical link: https://commits.webkit.org/255538@main
  • Loading branch information
pxlcoder committed Oct 14, 2022
1 parent a917e03 commit 0fb07ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -453,6 +453,16 @@ - (void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
}

#if HAVE(UIKIT_WEBKIT_INTERNALS)
- (void)viewIsAppearing:(BOOL)animated
{
self.view.clipsToBounds = YES;
self.view._continuousCornerRadius = self.view.window._continuousCornerRadius;

[super viewIsAppearing:animated];
}
#endif

- (void)viewDidLayoutSubviews
{
[self _updateWebViewFullscreenInsets];
Expand Down
Expand Up @@ -162,7 +162,10 @@ void store(WKWebView* webView)

} // namespace WebKit

static const NSTimeInterval kAnimationDuration = 0.2;
static constexpr NSTimeInterval kAnimationDuration = 0.2;
#if HAVE(UIKIT_WEBKIT_INTERNALS)
static constexpr CGFloat kFullScreenWindowCornerRadius = 12;
#endif

#pragma mark -

Expand Down Expand Up @@ -550,6 +553,8 @@ - (void)enterFullScreen:(CGSize)videoDimensions
#if HAVE(UIKIT_WEBKIT_INTERNALS)
CGFloat aspectRatio = videoDimensions.height ? (videoDimensions.width / videoDimensions.height) : (960.0 / 540.0);
[_window setFrame:CGRectMake(0, 0, 540 * aspectRatio, 540)];
[_window setClipsToBounds:YES];
[_window _setContinuousCornerRadius:kFullScreenWindowCornerRadius];
[_window setNeedsLayout];
[_window layoutIfNeeded];
#endif
Expand Down

0 comments on commit 0fb07ce

Please sign in to comment.