Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: bf7f0d4d340bc8285b6223cab137fccf445d3c1a https://github.com/WebKit/WebKit/commit/bf7f0d4d340bc8285b6223cab137fccf445d3c1a Author: Chris Dumez <cdu...@apple.com> Date: 2023-04-26 (Wed, 26 Apr 2023)
Changed paths: M Source/WebCore/PAL/pal/system/cocoa/SleepDisablerCocoa.h M Source/WebCore/PAL/pal/system/ios/SleepDisablerIOS.mm M Source/WebKit/UIProcess/API/APIUIClient.h M Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h M Source/WebKit/UIProcess/Cocoa/UIDelegate.h M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm M Source/WebKit/UIProcess/WebPageProxy.cpp M Source/WebKit/UIProcess/WebProcessProxy.cpp M Source/WebKit/UIProcess/WebProcessProxy.h M Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm M Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm Log Message: ----------- New Wake Lock API does not work in Home Screen Web Apps https://bugs.webkit.org/show_bug.cgi?id=254545 rdar://107284303 Reviewed by Geoffrey Garen. Home screen web apps are view controllers. Unfortunately, the [UIApplication idleTimerDisabled] API (which we rely on for the screen wake lock API) doesn't work in view controllers. I was told that we'll need to IPC the host app and have it use the UIApplication API. As a result, I have adding a UIDelegate SPI to ask the client to take / release the screen wake lock. If the client doesn't implement the delegate, then we fall back to using the UIApplication API directly. Note that the screen wake lock is global and the UIDelegate is per WKWebView, which is a little awkward. We make a best attempt to call the UIDelegate on a visible WKWbView when available, and on a random view when none is visible. WebKit doesn't currently have such global app-wide API / SPI. * Source/WebCore/PAL/pal/system/cocoa/SleepDisablerCocoa.h: * Source/WebCore/PAL/pal/system/ios/SleepDisablerIOS.mm: (PAL::ScreenSleepDisabler::setScreenWakeLockHandler): (PAL::ScreenSleepDisabler::updateState): (PAL::SleepDisablerCocoa::setScreenWakeLockHandler): * Source/WebKit/UIProcess/API/APIUIClient.h: (API::UIClient::setShouldKeepScreenAwake): * Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * Source/WebKit/UIProcess/Cocoa/UIDelegate.h: * Source/WebKit/UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::setShouldKeepScreenAwake): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::globalPageMap): (WebKit::WebProcessProxy::globalPages): (WebKit::WebProcessProxy::willRemoveWebPage): (WebKit::globalPageMap): Deleted. (WebKit::globalPages): Deleted. * Source/WebKit/UIProcess/WebProcessProxy.h: * Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm: (WebKit::WebProcessProxy::platformInitialize): * Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: (-[SetShouldKeepScreenAwakeDelegate _webView:setShouldKeepScreenAwake:]): Canonical link: https://commits.webkit.org/263419@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes