[webkit-changes] [WebKit/WebKit] a2d8d2: [Screen Time Refactoring] Add API to show system S...

Jessica Cheung noreply at github.com
Thu Feb 6 11:54:51 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a2d8d208f2cbb39feae772c55277edb794d8314d
      https://github.com/WebKit/WebKit/commit/a2d8d208f2cbb39feae772c55277edb794d8314d
  Author: Jessica Cheung <jcheung23 at apple.com>
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/APIPageConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm

  Log Message:
  -----------
  [Screen Time Refactoring] Add API to show system Screen Time blocking view or blurred view instead
https://bugs.webkit.org/show_bug.cgi?id=286845
rdar://140439133

Reviewed by Aditya Keerthi.

Add API to give clients the choice to show WebKit's system Screen Time blocking view
or blur the web content.
- If true, WebKit will show the Screen Time blocking view.
- If false, WebKit shows a blurred view of the web content, which isn't interact-able
nor can any web content be actually visible.

Add three new API tests for this bit, as well as checking if the appropriate views are
added in the view hierarchy.

In WKWebView, WKSTVisualEffectView is a subclass NSVisualEffectView and we
override mouseDown among other events. This is so when the blurred view is up,
we do not allow navigation to links via clicking links
that are "underneath" the blurred view or other interactions such as clicking on
an input text field.
In other words, this is to make the web content with the blurred view
not interact-able.

* Source/WebKit/UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::showsSystemScreenTimeBlockingView const):
(API::PageConfiguration::setShowsSystemScreenTimeBlockingView):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKSTVisualEffectView mouseDown:]):
(-[WKSTVisualEffectView rightMouseDown:]):
(-[WKSTVisualEffectView mouseMoved:]):
(-[WKSTVisualEffectView mouseEntered:]):
(-[WKSTVisualEffectView mouseExited:]):
(-[WKWebView _installScreenTimeWebpageController]):
(-[WKWebView observeValueForKeyPath:ofObject:change:context:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _showsSystemScreenTimeBlockingView]):
(-[WKWebViewConfiguration _setShowsSystemScreenTimeBlockingView:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm:
(blurredViewIsPresent):
(systemScreenTimeBlockingViewIsPresent):
(testShowsSystemScreenTimeBlockingView):
(TEST(ScreenTime, ShowSystemScreenTimeBlockingTrue)):
(TEST(ScreenTime, ShowSystemScreenTimeBlockingFalse)):
(TEST(ScreenTime, ShowSystemScreenTimeBlockingFalseAndRemoved)):

Canonical link: https://commits.webkit.org/289956@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list