[webkit-changes] [WebKit/WebKit] a03f43: TestWebKitAPI.KeyboardInputTests.EditableWebViewRe...

Wenson Hsieh noreply at github.com
Mon May 6 15:22:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a03f439c11675760e68b40b59fabfd4be3727c37
      https://github.com/WebKit/WebKit/commit/a03f439c11675760e68b40b59fabfd4be3727c37
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-05-06 (Mon, 06 May 2024)

  Changed paths:
    M Tools/TestRunnerShared/spi/UIKitSPIForTesting.h
    M Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm

  Log Message:
  -----------
  TestWebKitAPI.KeyboardInputTests.EditableWebViewRequiresKeyboardWhenFirstResponder fails on iPhone Simulator
https://bugs.webkit.org/show_bug.cgi?id=273737
rdar://127547640

Reviewed by Abrar Rahman Protyasha and Megan Gardner.

Prior to BrowserEngineKit adoption, WebKit would use UIKit SPI (`-[UIPressesEvent _hidEvent]`) to
keep track of when a hardware keyboard key is pressed; when observed, we'd then set a boolean flag,
`_seenHardwareKeyDownInNonEditableElement`, which allows us to then return YES from
`-_requiresKeyboardWhenFirstResponder`. This is crucial for key event compatibility, in the case
where the web page listens for key events outside of the context of editing, and the user is using a
hardware keyboard on iOS (and can therefore dispatch keyboard events without the help of a software
keyboard).

With BrowserEngineKit adoption, we no longer rely on the aforementioned SPI; UIKit instead
automatically returns `YES`, as long as `-hardwareKeyboardAttached` is set. However, because this is
set by default when running tests in the iOS simulator, `-_requiresKeyboardWhenFirstResponder` now
returns `YES` right after loading the test markup.

Account for this change in the test by swizzling out `-hardwareKeyboardAttached` to simulate the
keyboard being detached, when running this test.

* Tools/TestRunnerShared/spi/UIKitSPIForTesting.h:
* Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
(TestWebKitAPI::overrideHardwareKeyboardAttached):
(TestWebKitAPI::TEST(KeyboardInputTests, EditableWebViewRequiresKeyboardWhenFirstResponder)):

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