[webkit-changes] [WebKit/WebKit] 7bee9f: WebDriver: [macOS] [Actions] [Key] Shift modifier ...

Patrick Angle noreply at github.com
Wed Jan 18 10:32:40 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7bee9f5b488f917b7dae4b36c77e029505a747c1
      https://github.com/WebKit/WebKit/commit/7bee9f5b488f917b7dae4b36c77e029505a747c1
  Author: Patrick Angle <pangle at apple.com>
  Date:   2023-01-18 (Wed, 18 Jan 2023)

  Changed paths:
    M Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm

  Log Message:
  -----------
  WebDriver: [macOS] [Actions] [Key] Shift modifier not applying to typed text
https://bugs.webkit.org/show_bug.cgi?id=248770
rdar://100588610

Reviewed by BJ Burg.

AppKit expects the `characters` for an NSEvent to be pre-transformed to the actual character that will be typed, which
means for a capital letter, sending the key code for a letter with the shift modifier held should result in the capital
form of that letter being the `characters`. This also add support for composed characters, like Shift+Option+K resulting
in the Apple logo, or Shift+Option+8 resulting in the degree symbol.

The clearest way to obtain the OS-defined mapping for a letter and its modifiers is to create a temporary NSEvent and
call `-[NSEvent characterTransformingModifiers:]`, which applies the provided modifiers to an existing event's
`characters`, which we can then use to create the actual NSEvents we will dispatch to the system. Alternatively, we
could hardcode WebDriver's list of "shifted" characters, but that only covers keys on a US-English keyboard, and does
not provide any allowance for macOS's various Option/Shift modified key chords to produce special characters.

This progresses the following WPT test cases:
webdriver/tests/perform_actions/key_modifiers.py::test_shift_modifier_generates_capital_letters[\ue008]
webdriver/tests/perform_actions/key_modifiers.py::test_shift_modifier_generates_capital_letters[\ue050]

* Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):

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




More information about the webkit-changes mailing list