Title: [287094] trunk/Source
- Revision
- 287094
- Author
- jer.no...@apple.com
- Date
- 2021-12-15 12:09:13 -0800 (Wed, 15 Dec 2021)
Log Message
[Mac] Adopt -[NSScreen safeAreaInsets]
https://bugs.webkit.org/show_bug.cgi?id=234291
<rdar://85805895>
Reviewed by Eric Carlson.
Source/WebCore:
Adopt -safeAreaInsets and rename screenRectAvoidingMenuBar() to safeScreenFrame().
* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::safeScreenFrame): Renamed from screenRectAvoidingMenuBar.
Source/WebKit:
Drive-by fix: use the safeAreaFrame() when determining where to place the exit
fullscreen placeholder image.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimationAndExitImmediately:]):
Source/WTF:
* wtf/PlatformHave.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (287093 => 287094)
--- trunk/Source/WTF/ChangeLog 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WTF/ChangeLog 2021-12-15 20:09:13 UTC (rev 287094)
@@ -1,3 +1,13 @@
+2021-12-15 Jer Noble <jer.no...@apple.com>
+
+ [Mac] Adopt -[NSScreen safeAreaInsets]
+ https://bugs.webkit.org/show_bug.cgi?id=234291
+ <rdar://85805895>
+
+ Reviewed by Eric Carlson.
+
+ * wtf/PlatformHave.h:
+
2021-12-15 Chris Dumez <cdu...@apple.com>
Move SWServers from NetworkProcess to NetworkSession
Modified: trunk/Source/WTF/wtf/PlatformHave.h (287093 => 287094)
--- trunk/Source/WTF/wtf/PlatformHave.h 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2021-12-15 20:09:13 UTC (rev 287094)
@@ -1120,3 +1120,7 @@
#if ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000)
#define HAVE_UIFINDINTERACTION 1
#endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
+#define HAVE_NSSCREEN_SAFE_AREA 1
+#endif
Modified: trunk/Source/WebCore/ChangeLog (287093 => 287094)
--- trunk/Source/WebCore/ChangeLog 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WebCore/ChangeLog 2021-12-15 20:09:13 UTC (rev 287094)
@@ -1,3 +1,17 @@
+2021-12-15 Jer Noble <jer.no...@apple.com>
+
+ [Mac] Adopt -[NSScreen safeAreaInsets]
+ https://bugs.webkit.org/show_bug.cgi?id=234291
+ <rdar://85805895>
+
+ Reviewed by Eric Carlson.
+
+ Adopt -safeAreaInsets and rename screenRectAvoidingMenuBar() to safeScreenFrame().
+
+ * platform/PlatformScreen.h:
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::safeScreenFrame): Renamed from screenRectAvoidingMenuBar.
+
2021-12-15 Alex Christensen <achristen...@webkit.org>
More cleanup after PluginProcess removal
Modified: trunk/Source/WebCore/platform/PlatformScreen.h (287093 => 287094)
--- trunk/Source/WebCore/platform/PlatformScreen.h 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WebCore/platform/PlatformScreen.h 2021-12-15 20:09:13 UTC (rev 287094)
@@ -140,7 +140,7 @@
IORegistryGPUID gpuIDForDisplay(PlatformDisplayID);
IORegistryGPUID gpuIDForDisplayMask(uint32_t);
-WEBCORE_EXPORT FloatRect screenRectAvoidingMenuBar(NSScreen *);
+WEBCORE_EXPORT FloatRect safeScreenFrame(NSScreen *);
#endif // !PLATFORM(MAC)
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (287093 => 287094)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2021-12-15 20:09:13 UTC (rev 287094)
@@ -44,10 +44,6 @@
#import <pal/cocoa/MediaToolboxSoftLink.h>
#endif
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PlatformScreenMac.h>)
-#import <WebKitAdditions/PlatformScreenMac.h>
-#endif
-
namespace WebCore {
// These functions scale between screen and page coordinates because _javascript_/DOM operations
@@ -419,14 +415,16 @@
return flippedPoint;
}
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PlatformScreenMac.mm>)
-#import <WebKitAdditions/PlatformScreenMac.mm>
-#else
-FloatRect screenRectAvoidingMenuBar(NSScreen* screen)
+FloatRect safeScreenFrame(NSScreen* screen)
{
- return screen.frame;
+ FloatRect frame = screen.frame;
+#if HAVE(NSSCREEN_SAFE_AREA)
+ auto insets = screen.safeAreaInsets;
+ frame.contract(insets.left + insets.right, insets.top + insets.bottom);
+ frame.move(insets.left, insets.bottom);
+#endif
+ return frame;
}
-#endif
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (287093 => 287094)
--- trunk/Source/WebKit/ChangeLog 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WebKit/ChangeLog 2021-12-15 20:09:13 UTC (rev 287094)
@@ -1,3 +1,18 @@
+2021-12-15 Jer Noble <jer.no...@apple.com>
+
+ [Mac] Adopt -[NSScreen safeAreaInsets]
+ https://bugs.webkit.org/show_bug.cgi?id=234291
+ <rdar://85805895>
+
+ Reviewed by Eric Carlson.
+
+ Drive-by fix: use the safeAreaFrame() when determining where to place the exit
+ fullscreen placeholder image.
+
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ (-[WKFullScreenWindowController enterFullScreen:]):
+ (-[WKFullScreenWindowController finishedExitFullScreenAnimationAndExitImmediately:]):
+
2021-12-15 Alex Christensen <achristen...@webkit.org>
More cleanup after PluginProcess removal
Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (287093 => 287094)
--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2021-12-15 19:57:41 UTC (rev 287093)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2021-12-15 20:09:13 UTC (rev 287094)
@@ -228,7 +228,7 @@
if (!screen)
screen = [NSScreen mainScreen];
- NSRect screenFrame = WebCore::screenRectAvoidingMenuBar(screen);
+ NSRect screenFrame = WebCore::safeScreenFrame(screen);
NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
// Flip coordinate system:
@@ -520,7 +520,7 @@
[CATransaction begin];
[CATransaction setDisableActions:YES];
NSRect exitPlaceholderScreenRect = _initialFrame;
- exitPlaceholderScreenRect.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(exitPlaceholderScreenRect);
+ exitPlaceholderScreenRect.origin.y = NSMaxY(WebCore::safeScreenFrame([[NSScreen screens] objectAtIndex:0])) - NSMaxY(exitPlaceholderScreenRect);
RetainPtr<CGImageRef> webViewContents = takeWindowSnapshot([[_webView window] windowNumber], true);
webViewContents = adoptCF(CGImageCreateWithImageInRect(webViewContents.get(), NSRectToCGRect(exitPlaceholderScreenRect)));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes