Title: [244545] trunk/Source
- Revision
- 244545
- Author
- [email protected]
- Date
- 2019-04-23 09:25:30 -0700 (Tue, 23 Apr 2019)
Log Message
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 <[email protected]> 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (244544 => 244545)
--- trunk/Source/WebCore/ChangeLog 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebCore/ChangeLog 2019-04-23 16:25:30 UTC (rev 244545)
@@ -1,3 +1,24 @@
+2019-04-23 Remy Demarest <[email protected]>
+
+ Fix layout issues occuring when entering full screen mode.
+ https://bugs.webkit.org/show_bug.cgi?id=197086
+ <rdar://problem/47733671>.
+
+ 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.
+
+ * 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.
+
2019-04-23 Chris Dumez <[email protected]>
[Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
Modified: trunk/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm (244544 => 244545)
--- trunk/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm 2019-04-23 16:25:30 UTC (rev 244545)
@@ -53,6 +53,17 @@
return self;
}
+- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
+{
+ UNUSED_PARAM(screen);
+ return frameRect;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+ return NO;
+}
+
- (BOOL)canBecomeKeyWindow
{
return YES;
Modified: trunk/Source/WebKit/ChangeLog (244544 => 244545)
--- trunk/Source/WebKit/ChangeLog 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebKit/ChangeLog 2019-04-23 16:25:30 UTC (rev 244545)
@@ -1,3 +1,32 @@
+2019-04-23 Remy Demarest <[email protected]>
+
+ Fix layout issues occuring when entering full screen mode.
+ https://bugs.webkit.org/show_bug.cgi?id=197086
+ <rdar://problem/47733671>.
+
+ 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.
+
+ * 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.
+
2019-04-23 John Wilander <[email protected]>
Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
Modified: trunk/Source/WebKit/Platform/spi/mac/AppKitSPI.h (244544 => 244545)
--- trunk/Source/WebKit/Platform/spi/mac/AppKitSPI.h 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebKit/Platform/spi/mac/AppKitSPI.h 2019-04-23 16:25:30 UTC (rev 244545)
@@ -47,6 +47,10 @@
- (void)setInspectorBar:(NSInspectorBar *)bar;
@end
+@interface NSWindow (FullScreenSupport)
+@property CGFloat titlebarAlphaValue;
+@end
+
#endif
@interface NSInspectorBar (IPI)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (244544 => 244545)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-04-23 16:25:30 UTC (rev 244545)
@@ -2610,7 +2610,7 @@
NSWindow *WebViewImpl::fullScreenWindow()
{
#if ENABLE(FULLSCREEN_API)
- return [[[WebCoreFullScreenWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:(NSWindowStyleMaskBorderless | NSWindowStyleMaskResizable) backing:NSBackingStoreBuffered defer:NO] autorelease];
+ return [[[WebCoreFullScreenWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskUnifiedTitleAndToolbar | NSWindowStyleMaskFullSizeContentView | NSWindowStyleMaskResizable) backing:NSBackingStoreBuffered defer:NO] autorelease];
#else
return nil;
#endif
Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (244544 => 244545)
--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2019-04-23 16:14:05 UTC (rev 244544)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2019-04-23 16:25:30 UTC (rev 244545)
@@ -29,6 +29,7 @@
#import "WKFullScreenWindowController.h"
+#import "AppKitSPI.h"
#import "LayerTreeContext.h"
#import "VideoFullscreenManagerProxy.h"
#import "WKAPICast.h"
@@ -126,6 +127,9 @@
[window setDelegate:self];
[window setCollectionBehavior:([window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary)];
+ // Hide the titlebar during the animation to full screen so that only the WKWebView content is visible.
+ window.titlebarAlphaValue = 0;
+
NSView *contentView = [window contentView];
contentView.hidden = YES;
contentView.autoresizesSubviews = YES;
@@ -341,6 +345,9 @@
NSSize minContentSize = self.window.contentMinSize;
minContentSize.width = minVideoWidth;
self.window.contentMinSize = minContentSize;
+
+ // Always show the titlebar in full screen mode.
+ self.window.titlebarAlphaValue = 1;
} else {
// Transition to fullscreen failed. Clean up.
_fullScreenState = NotInFullScreen;
@@ -475,6 +482,9 @@
return;
_fullScreenState = NotInFullScreen;
+ // Hide the titlebar at the end of the animation so that it can slide away without turning blank.
+ self.window.titlebarAlphaValue = 0;
+
NSResponder *firstResponder = [[self window] firstResponder];
[CATransaction begin];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes