Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a973945efe9be185fd15ea8ef447ab369729094c
      
https://github.com/WebKit/WebKit/commit/a973945efe9be185fd15ea8ef447ab369729094c
  Author: Brent Fulgham <[email protected]>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    A Source/WebKit/Shared/Cocoa/AutomationKeyIdentity.h
    M Source/WebKit/Shared/ios/WebIOSEventFactory.mm
    M Source/WebKit/Shared/mac/WebEventFactory.mm
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.h
    M Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm
    M Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm
    M Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [Cocoa] WebDriver should state the DOM identity of synthesized key events
https://bugs.webkit.org/show_bug.cgi?id=323773
rdar://187036197

Reviewed by BJ Burg.

Automation synthesizes a platform key event and lets WebCore derive the DOM 
'key', 'code'
and location from its key code. Unfortunately, that only works for keys Apple 
keyboards
have. The WebDriver key table also contains Insert, Pause and Cancel, which 
have no macOS
key code, so none of them were reporting a DOM code. Cancel was aliased to 
Escape outright.
On iOS the problem is broader: no key code is supplied at all and 
WebIOSEventFactory
hardcodes isKeypad to false, so the keypad's navigation keys can never report 
Numpad* codes
or DOM_KEY_LOCATION_NUMPAD.

Rather than invent macOS key codes for keys that do not exist, let the 
automation path
state the identity directly. keyIdentityForVirtualKey() holds the values from 
the WebDriver
key table; the platform code attaches them to each synthesized event, and the 
event
factories report them in place of the derived ones. The events are still 
dispatched through
AppKit, so key equivalents, input methods and editing commands are unaffected.

This allows us to pass 3 more subtests.

Tests: webdriver/tests/classic/perform_actions/key_events.py

* Source/WebKit/Shared/Cocoa/AutomationKeyIdentity.h: Added.
(WebKit::AutomationKeyIdentity::setIdentity):
(WebKit::AutomationKeyIdentity::identity):
* Source/WebKit/Shared/ios/WebIOSEventFactory.mm:
(WebKit::WebIOSEventFactory::createWebKeyboardEvent):
* Source/WebKit/Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebKeyboardEvent):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
* Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
(WebKit::keyIdentityForVirtualKey):
(WebKit::WebAutomationSession::setKeyIdentityForVirtualKeyIfNeeded):
* Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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



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

Reply via email to