Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 861cf0f5c389289bcc249a923b2d0a476f8f42b3
https://github.com/WebKit/WebKit/commit/861cf0f5c389289bcc249a923b2d0a476f8f42b3
Author: Jessica Cheung <[email protected]>
Date: 2025-02-17 (Mon, 17 Feb 2025)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h
M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm
Log Message:
-----------
[Screen Time Refactoring] Do not show shield and perform donations for
offscreen web views
https://bugs.webkit.org/show_bug.cgi?id=287445
rdar://144572971
Reviewed by Aditya Keerthi.
Added function and logic _showScreenTimeShieldForWindow which
checks for two cases:
- if we are showing the system Screen Time blocking view,
hide or show the view depending on if the webview is on/offscreen
- if we are showing a blurred blocking view instead of the system
blocking view _and_ the view is currently not nil,
hide or show the view depending on if the webview is on/offscreen
Note that in _showScreenTimeShieldForWindow, we check if we
_showsSystemScreenTimeBlockingView in both cases instead of assuming
a standard if-else case because the blurred blocking view is added and
removed _on demand_ while the system Screen Time blocking view is only
added once and removed once.
This is because the system Screen Time blocking view will
be painted/showed or not depending on if the URLIsBLocked.
Created three new API tests:
- offscreenSystemScreenTimeBlockingView
- offscreenBlurredScreenTimeBlockingView
- doNotDonateURLsInOffscreen, which tests if we suppress usage recording
when the webview is on/offscreen
To not track URLs while offscreen, we need to set suppress usage recording
if either in private browsing or not in window
(which includes being occluded on macOS but not on iOS).
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _uninstallScreenTimeWebpageController]):
(-[WKWebView _updateScreenTimeShieldVisibilityForWindow]):
(-[WKWebView _screenTimeBlurredSnapshot]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::viewIsBecomingVisible):
(WebKit::PageClientImplCocoa::viewIsBecomingInvisible):
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::viewIsBecomingInvisible):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewIsBecomingInvisible):
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::viewIsBecomingVisible):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm:
(TEST(ScreenTime, OffscreenSystemScreenTimeBlockingView)):
(TEST(ScreenTime, OffscreenBlurredScreenTimeBlockingView)):
(TEST(ScreenTime, DoNotDonateURLsInOffscreenWebView)):
Canonical link: https://commits.webkit.org/290486@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes