Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd0b584ba9075b8afc8865692d29542efc051bad
      
https://github.com/WebKit/WebKit/commit/bd0b584ba9075b8afc8865692d29542efc051bad
  Author: Patrick Angle <[email protected]>
  Date:   2023-01-19 (Thu, 19 Jan 2023)

  Changed paths:
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp
    M Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
    M Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm
    M Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm
    M Source/cmake/WebKitFeatures.cmake

  Log Message:
  -----------
  WebDriver: [Cocoa] [Actions] [Key] Single grapheme clusters return an 
exception indicating the key is not valid
https://bugs.webkit.org/show_bug.cgi?id=248909
rdar://100588599

Reviewed by BJ Burg.

Input handling was previously making the assumption that every character could 
be represented by a single unicode code
point. That assumption does not hold true, and has already been worked around 
for getting a supplementary code point
value (U+10000..U+10ffff) from its lead and trail surrogates. That solution 
does not scale however beyond two
codepoints, or for characters outside that range. Instead we should think of 
characters in terms of grapheme clusters
and allow a single grapheme cluster to be virtually "pressed" or "released" at 
a time. This allows for expressing many
more characters from many languages via keyboard actions to WebDriver.

Additionally, there was an issue where characters not representable by a 
virtual key in Carbon were appearing with the
key code of `KeyA` in Javascript, since on macOS `KeyA` has a value of 0.

Supporting full grapheme cluster keyboard actions is only enabled on Cocoa 
ports in the patch. Additionally,
`safaridriver` also needs to be updated to send more than a single codepoint to 
WebKit for these characters.

This progresses the following WPT test cases:
webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\xe0-]
webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\u0416-]
webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\u2603-]
webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\uf6c2-]
webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f604]
webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f60d]
webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\u0ba8\u0bbf]
webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\u1100\u1161\u11a8]

* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp:
(WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
* Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h:
- Make "KeyChar" represent more than one unicode code point (with the assertion 
that it continue to only represent a single grapheme cluster).

* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::performInteractionSequence):
- On supported platforms, simply ensure that the key character string is a 
single grapheme cluster and set the code appropriately.

* Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::keyCodeForCharKey):
(WebKit::keyCodeForVirtualKey):
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
- Support the new String version of KeyChar.
- Don't map unknown keys to 0, as that is the same as mapping them to the `A` 
keycode on macOS.

* Source/cmake/WebKitFeatures.cmake:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to