Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 697b1a86cea65c70aa013ce7402a16a516181baf
      
https://github.com/WebKit/WebKit/commit/697b1a86cea65c70aa013ce7402a16a516181baf
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h
    M Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm

  Log Message:
  -----------
  [ iOS ] 3x editing/spelling/* (layout-tests) are constant failures
https://bugs.webkit.org/show_bug.cgi?id=271864
rdar://125585822

Reviewed by Aditya Keerthi.

Among the many other changes to adopt `BETextInput`, iOS 17.4 refactored 
`WKContentView` to stop
relying on the UIKit internal method `-_requiresKeyboardWhenFirstResponder`. 
Instead, UIKit now
returns `YES` when the delegate is a `BETextInput`, as long as either of the 
following are true:

1. The hardware keyboard is connected.
2. An editable element is focused.

However, a consequence of this refactoring is that `WKContentView` now vends 
text input traits to
keyboard code in UIKit when a hardware keyboard is attached, even in the case 
where there is no
focused element. In practice, this doesn't really matter, since these text 
input traits (which
contain `UITextAutocorrectionTypeNo`) are effectively unused. However, in the 
case of these three
layout tests that programmatically focus text inputs, insert text, and expect 
spellchecking to
occur outside of the context of any input session, we end up failing because 
the spelling
corrections are disabled by the traits.

To fix this, restore pre-iOS 17.4 behavior by reverting to 
`WKExtendedTextInputTraits`'s default
values when no element is focused (or being focused). Namely, this ensures that 
the autocorrection
type is set to `UITextAutocorrectionTypeDefault`, which matches shipping 
behavior in the case when
the user isn't focusing anything editable, but still enables continuous 
spellchecking when
programmatically inserting text.

* LayoutTests/platform/ios/TestExpectations:

Mark these layout test as passing again.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateTextInputTraits:]):
(-[WKContentView extendedTraitsDelegate]):

See above for more details.

* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h:
* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm:
(-[WKExtendedTextInputTraits init]):
(-[WKExtendedTextInputTraits setSelectionColorsToMatchTintColor:]):
(-[WKExtendedTextInputTraits restoreDefaultValues]):

Add a new method to restore all default text input traits.

(-[WKExtendedTextInputTraits setSelectionBarColor:]): Deleted.
(-[WKExtendedTextInputTraits selectionBarColor]): Deleted.

Remove some old versions of the `UIAsyncTextInput` implementation that are no 
longer necessary,
since they've all been superceded by `BETextInput`.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to