Fix layout issues occuring when entering full screen mode.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 16:25:30 +0000 (16:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 16:25:30 +0000 (16:25 +0000)
commitf39278fdc59246a2ea0361e8752a47004bc61a73
treeddd886bdbe85a244d0e4f5cdfd71c7bd0c2c4071
parent600ea1374bb76a6a2906fb6de5c70b92d304b281
Fix layout issues occuring when entering full screen mode.
https://bugs.webkit.org/show_bug.cgi?id=197086
<rdar://problem/47733671>.

Patch by Remy Demarest <rdemarest@apple.com> on 2019-04-23
Reviewed by Darin Adler.

This issue is the result of changing the style mask of the window after entering
full screen mode. Safari adds an invisible toolbar to display the URL of the page
which ends up breaking the layout. Having that window use a style that includes a
titlebar fixes the bug.

Source/WebCore:

* platform/mac/WebCoreFullScreenWindow.mm:
(-[WebCoreFullScreenWindow constrainFrameRect:toScreen:]): Ensure that the window
can fill the entire screen including the underlapping the menu bar, so that the
window does not resize when the animation is done.
(-[WebCoreFullScreenWindow canBecomeMainWindow]): Borderless windows cannot become
main by default, adding the titlebar allows it to become main, prevent this from
happening at all to preserve the existing behavior.

Source/WebKit:

* Platform/spi/mac/AppKitSPI.h:
Declare an SPI to be used in WKFullScreenWindowController.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
and make the content view underlap the titlebar to match the current behavior.
Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
before beginning the animation to full screen.
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
bar when in full screen instead of a blank bar.
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
bar to restore the initial setting.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm
Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/mac/AppKitSPI.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm