Title: [280976] trunk/Source
Revision
280976
Author
[email protected]
Date
2021-08-12 12:16:04 -0700 (Thu, 12 Aug 2021)

Log Message

[macOS] Enter fullscreen animation interferes with auto-hiding menu bar
https://bugs.webkit.org/show_bug.cgi?id=229039
<rdar://79150656>

Reviewed by Eric Carlson.

Source/WebCore:

Add a new utility method to calculate the available screen rect taking menu bar
hiding into account.

* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenRectAvoidingMenuBar):

Source/WebKit:

When entering fullscreen, if a user has unchecked the "auto-hide menu bar in fullscreen"
setting, the fullscreen animation will enter to the full screen frame, then snap down once
the animation completes to reveal the menu bar. Instead, use a WebCore utility method to
calculate the screen's frame taking that menu bar into account, and use it for the initial
enter fullscreen animation.

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280975 => 280976)


--- trunk/Source/WebCore/ChangeLog	2021-08-12 19:13:00 UTC (rev 280975)
+++ trunk/Source/WebCore/ChangeLog	2021-08-12 19:16:04 UTC (rev 280976)
@@ -1,3 +1,18 @@
+2021-08-12  Jer Noble  <[email protected]>
+
+        [macOS] Enter fullscreen animation interferes with auto-hiding menu bar
+        https://bugs.webkit.org/show_bug.cgi?id=229039
+        <rdar://79150656>
+
+        Reviewed by Eric Carlson.
+
+        Add a new utility method to calculate the available screen rect taking menu bar
+        hiding into account.
+
+        * platform/PlatformScreen.h:
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::screenRectAvoidingMenuBar):
+
 2021-08-12  Devin Rousso  <[email protected]>
 
         Fix some `NSAttributedString` inconsistencies between WK1 and WK2

Modified: trunk/Source/WebCore/platform/PlatformScreen.h (280975 => 280976)


--- trunk/Source/WebCore/platform/PlatformScreen.h	2021-08-12 19:13:00 UTC (rev 280975)
+++ trunk/Source/WebCore/platform/PlatformScreen.h	2021-08-12 19:16:04 UTC (rev 280976)
@@ -117,6 +117,7 @@
 
 FloatRect screenRectForDisplay(PlatformDisplayID);
 WEBCORE_EXPORT FloatRect screenRectForPrimaryScreen();
+WEBCORE_EXPORT FloatRect availableScreenRect(NSScreen *);
 
 WEBCORE_EXPORT FloatRect toUserSpace(const NSRect&, NSWindow *destination);
 WEBCORE_EXPORT FloatRect toUserSpaceForPrimaryScreen(const NSRect&);
@@ -133,6 +134,8 @@
 IORegistryGPUID gpuIDForDisplay(PlatformDisplayID);
 IORegistryGPUID gpuIDForDisplayMask(uint32_t);
 
+WEBCORE_EXPORT FloatRect screenRectAvoidingMenuBar(NSScreen *);
+
 #endif // !PLATFORM(MAC)
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (280975 => 280976)


--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2021-08-12 19:13:00 UTC (rev 280975)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2021-08-12 19:16:04 UTC (rev 280976)
@@ -44,6 +44,10 @@
 #import <pal/cocoa/MediaToolboxSoftLink.h>
 #endif
 
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PlatformScreenIOS.mm>)
+#import <WebKitAdditions/PlatformScreenMac.h>
+#endif
+
 namespace WebCore {
 
 // These functions scale between screen and page coordinates because _javascript_/DOM operations
@@ -415,6 +419,16 @@
     return flippedPoint;
 }
 
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PlatformScreenIOS.mm>)
+#import <WebKitAdditions/PlatformScreenMac.mm>
+#else
+FloatRect screenRectAvoidingMenuBar(NSScreen* screen)
+{
+    return screen.frame;
+}
+#endif
+
+
 } // namespace WebCore
 
 #endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit/ChangeLog (280975 => 280976)


--- trunk/Source/WebKit/ChangeLog	2021-08-12 19:13:00 UTC (rev 280975)
+++ trunk/Source/WebKit/ChangeLog	2021-08-12 19:16:04 UTC (rev 280976)
@@ -1,3 +1,20 @@
+2021-08-12  Jer Noble  <[email protected]>
+
+        [macOS] Enter fullscreen animation interferes with auto-hiding menu bar
+        https://bugs.webkit.org/show_bug.cgi?id=229039
+        <rdar://79150656>
+
+        Reviewed by Eric Carlson.
+
+        When entering fullscreen, if a user has unchecked the "auto-hide menu bar in fullscreen"
+        setting, the fullscreen animation will enter to the full screen frame, then snap down once
+        the animation completes to reveal the menu bar. Instead, use a WebCore utility method to
+        calculate the screen's frame taking that menu bar into account, and use it for the initial
+        enter fullscreen animation.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController enterFullScreen:]):
+
 2021-08-12  Devin Rousso  <[email protected]>
 
         Fix some `NSAttributedString` inconsistencies between WK1 and WK2

Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (280975 => 280976)


--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2021-08-12 19:13:00 UTC (rev 280975)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2021-08-12 19:16:04 UTC (rev 280976)
@@ -227,8 +227,8 @@
 
     if (!screen)
         screen = [NSScreen mainScreen];
-    NSRect screenFrame = [screen frame];
 
+    NSRect screenFrame = WebCore::screenRectAvoidingMenuBar(screen);
     NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
 
     // Flip coordinate system:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to