[webkit-changes] [WebKit/WebKit] 7af7fa: [iOS] Many layout tests are failing after some cha...

Wenson Hsieh noreply at github.com
Tue Sep 17 13:17:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7af7faec853a98f9d17e7cb3a76e2ae9fa837d22
      https://github.com/WebKit/WebKit/commit/7af7faec853a98f9d17e7cb3a76e2ae9fa837d22
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M LayoutTests/editing/input/cocoa/do-not-allow-inline-predictions-if-text-changes.html
    M LayoutTests/editing/input/cocoa/writing-suggestions-in-anonymous-renderer-expected.html
    M LayoutTests/editing/input/cocoa/writing-suggestions-in-anonymous-renderer.html
    M LayoutTests/editing/input/cocoa/writing-suggestions-textarea-multiple-lines.html
    M LayoutTests/fast/events/ios/activating-button-should-not-scroll-page.html
    M LayoutTests/fast/events/ios/activating-checkbox-should-not-scroll-page.html
    M LayoutTests/fast/events/ios/activating-radio-button-should-not-scroll-page.html
    M LayoutTests/fast/events/ios/activating-reset-button-should-not-scroll-page.html
    M LayoutTests/fast/events/ios/activating-submit-button-should-not-scroll-page.html
    M LayoutTests/fast/events/ios/keydown-keyup-keypress-keys-in-non-editable-using-chinese-keyboard.html
    M LayoutTests/fast/events/ios/keypress-keys-in-non-editable-element.html
    M LayoutTests/fast/events/ios/tab-into-text-field-inside-iframe.html
    M LayoutTests/fast/events/touch/ios/touch-event-stall-after-navigating-with-pending-asynchronous-touch-start.html
    M LayoutTests/fast/forms/caps-lock-indicator-width.html
    M LayoutTests/fast/forms/ios/focus-radio.html
    M LayoutTests/fast/forms/ios/focus-reset-button.html
    M LayoutTests/fast/forms/ios/focus-ring-size.html
    M LayoutTests/fast/forms/ios/focus-search-field.html
    M LayoutTests/fast/forms/ios/focus-submit-button.html
    M LayoutTests/fast/forms/ios/focus-text-field.html
    M LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard.html
    M LayoutTests/fast/scrolling/ios/key-command-scroll-to-bottom.html
    M LayoutTests/fast/scrolling/ios/key-command-scroll-to-top.html
    M LayoutTests/fast/scrolling/ios/scroll-to-beginning-and-end-of-document.html
    M LayoutTests/fast/scrolling/keyboard-scrolling-distance-downArrow.html
    M LayoutTests/platform/ios/TestExpectations
    M Tools/WebKitTestRunner/TestController.h
    M Tools/WebKitTestRunner/TestOptions.cpp
    M Tools/WebKitTestRunner/TestOptions.h
    M Tools/WebKitTestRunner/ios/TestControllerIOS.mm
    M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

  Log Message:
  -----------
  [iOS] Many layout tests are failing after some changes in UIKit (rdar://133635866)
https://bugs.webkit.org/show_bug.cgi?id=279794
rdar://136090040

Reviewed by Abrar Rahman Protyasha.

Several layout tests that rely on the ability to dispatch events via the hardware keyboard are
failing after the UIKit changes in rdar://133635866, because WebKitTestRunnerApp swizzles out the
SPI method (`+[UIKeyboard isInHardwareKeyboardMode]`) that UIKit now uses to determine whether
WebKit's content view should receive key events.

This SPI method has historically been swizzled out in order to ensure that various tests in
`editing/` and `fast/forms/` aren't flaky, due to the input view appearing on iOS. At the same time,
we also run tests with a connected hardware keyboard using `GSEventSetHardwareKeyboardAttached`, to
ensure that tests which rely on receiving key events without focusing an editable element also run
as expected. While this state is inherently contradictory, it Just Works™ on shipping iOS, only
because UIKit used `-[UIKeyboardImpl hardwareKeyboardAttached]` to determine whether or not it
should send hardware key events to the web view.

Now that UIKit uses `+isInHardwareKeyboardMode`, this new logic now collides with the way in which
WebKitTestRunnerApp swizzles out `+isInHardwareKeyboardMode` to prevent input sessions from starting
by default. To fix this, we add a new test option — `useHardwareKeyboardMode` — and deploy it in a
handful of tests that require hardware keyboard support, to ensure that `+isInHardwareKeyboardMode`
returns `YES` for the tests that require it.

* LayoutTests/editing/input/cocoa/do-not-allow-inline-predictions-if-text-changes.html:
* LayoutTests/editing/input/cocoa/writing-suggestions-in-anonymous-renderer-expected.html:
* LayoutTests/editing/input/cocoa/writing-suggestions-in-anonymous-renderer.html:
* LayoutTests/editing/input/cocoa/writing-suggestions-textarea-multiple-lines.html:
* LayoutTests/fast/events/ios/activating-button-should-not-scroll-page.html:
* LayoutTests/fast/events/ios/activating-checkbox-should-not-scroll-page.html:
* LayoutTests/fast/events/ios/activating-radio-button-should-not-scroll-page.html:
* LayoutTests/fast/events/ios/activating-reset-button-should-not-scroll-page.html:
* LayoutTests/fast/events/ios/activating-submit-button-should-not-scroll-page.html:
* LayoutTests/fast/events/ios/keydown-keyup-keypress-keys-in-non-editable-using-chinese-keyboard.html:
* LayoutTests/fast/events/ios/keypress-keys-in-non-editable-element.html:
* LayoutTests/fast/events/ios/tab-into-text-field-inside-iframe.html:
* LayoutTests/fast/events/touch/ios/touch-event-stall-after-navigating-with-pending-asynchronous-touch-start.html:
* LayoutTests/fast/forms/caps-lock-indicator-width.html:
* LayoutTests/fast/forms/ios/focus-radio.html:
* LayoutTests/fast/forms/ios/focus-reset-button.html:
* LayoutTests/fast/forms/ios/focus-ring-size.html:
* LayoutTests/fast/forms/ios/focus-search-field.html:
* LayoutTests/fast/forms/ios/focus-submit-button.html:
* LayoutTests/fast/forms/ios/focus-text-field.html:
* LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard.html:
* LayoutTests/fast/scrolling/ios/key-command-scroll-to-bottom.html:
* LayoutTests/fast/scrolling/ios/key-command-scroll-to-top.html:
* LayoutTests/fast/scrolling/ios/scroll-to-beginning-and-end-of-document.html:
* LayoutTests/fast/scrolling/keyboard-scrolling-distance-downArrow.html:

Deploy the new test option, `useHardwareKeyboardMode`, in several failing layout tests that
currently assume that the hardware keyboard is connected.

* LayoutTests/platform/ios/TestExpectations:

Skip a test that's no longer relevant on iOS 17+, since we no longer show the caps lock indicator
inside of the text field. Instead, the caps lock indicator is shown underneath the text cursor.

* Tools/WebKitTestRunner/TestController.h:
(WTR::TestController::setIsInHardwareKeyboardMode):
(WTR::TestController::isInHardwareKeyboardMode const):
* Tools/WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* Tools/WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::useHardwareKeyboardMode const):
* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(overrideIsInHardwareKeyboardMode):
(WTR::TestController::platformInitialize):
(WTR::TestController::platformResetStateToConsistentValues):
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::setHardwareKeyboardAttached):

Consolidate logic to override `+isInHardwareKeyboard` into a common helper method on
`TestController`, and call into it from `UIScriptController` to avoid duplicating code.

(WTR::returnYes): Deleted.
(WTR::returnNo): Deleted.

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