[webkit-changes] [WebKit/WebKit] b5e71b: Add a mechanism for tracking whether web pages hav...

Brady Eidson noreply at github.com
Tue May 14 16:06:19 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5e71b32c88ce4dfbcb216ab61dea9535727dbfd
      https://github.com/WebKit/WebKit/commit/b5e71b32c88ce4dfbcb216ab61dea9535727dbfd
  Author: Brady Eidson <beidson at apple.com>
  Date:   2024-05-14 (Tue, 14 May 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp
    M Source/WebCore/Modules/gamepad/NavigatorGamepad.h
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    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/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Tools/TestWebKitAPI/Tests/mac/HIDGamepads.mm

  Log Message:
  -----------
  Add a mechanism for tracking whether web pages have "recently" used gamepads
rdar://127892698
https://bugs.webkit.org/show_bug.cgi?id=274134

Reviewed by Sihui Liu.

In some configurations the UIProcess might want to configure specific behaviors based on
whether or not content in a web page has "recently" accessed gamepads via JavaScript.

Do to the polling nature of navigator.getGamepads() we consider a web page to have "recently"
accessed them as long as that function is called periodically during an arbitrary timespan
I have arbitrarily chosen as 1.5 seconds.

This patch adds the behavior and tests it via TestWebKitAPI.
Actually using this behavior to do something interesting will come in a followup.

* Source/WebCore/Headers.cmake:

* Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp:
(WebCore::NavigatorGamepad::setGamepadsRecentlyAccessedThreshold):
(WebCore::NavigatorGamepad::maybeNotifyRecentAccess):
(WebCore::NavigatorGamepad::gamepads):
* Source/WebCore/Modules/gamepad/NavigatorGamepad.h:

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::gamepadsRecentlyAccessed):

* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::recentlyAccessedGamepadsForTesting):
(API::UIClient::stoppedAccessingGamepadsForTesting):

* 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::recentlyAccessedGamepadsForTesting):
(WebKit::UIDelegate::UIClient::stoppedAccessingGamepadsForTesting):

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::m_recentGamepadAccessHysteresis):
(WebKit::WebPageProxy::recentGamepadAccessStateChanged):
(WebKit::WebPageProxy::gamepadsRecentlyAccessed):
(WebKit::m_browsingContextGroup): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:

* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::gamepadsRecentlyAccessed):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::gamepadsRecentlyAccessed):
* Source/WebKit/WebProcess/WebPage/WebPage.h:

* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

* Tools/TestWebKitAPI/Tests/mac/HIDGamepads.mm:
(-[GamepadUIDelegate _webViewRecentlyAccessedGamepadsForTesting:]):
(-[GamepadUIDelegate _webViewStoppedAccessingGamepadsForTesting:]):
(TestWebKitAPI::(Gamepad, GamepadState)):

Canonical link: https://commits.webkit.org/278782@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