[webkit-changes] [WebKit/WebKit] ff2454: [iOS] Base writing direction should update to refl...

Wenson Hsieh noreply at github.com
Tue Jan 14 20:33:55 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff24546a6c0762f37c9d67c10f91aee76a868b99
      https://github.com/WebKit/WebKit/commit/ff24546a6c0762f37c9d67c10f91aee76a868b99
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2025-01-14 (Tue, 14 Jan 2025)

  Changed paths:
    A LayoutTests/editing/input/ios/update-writing-direction-after-inserting-newline-expected.txt
    A LayoutTests/editing/input/ios/update-writing-direction-after-inserting-newline.html
    M Source/WebKit/Shared/Cocoa/InsertTextOptions.h
    M Source/WebKit/Shared/Cocoa/InsertTextOptions.serialization.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  [iOS] Base writing direction should update to reflect active input mode after inserting a newline
https://bugs.webkit.org/show_bug.cgi?id=285960
rdar://142411271

Reviewed by Abrar Rahman Protyasha.

Add a heuristic to automatically set the base writing direction to match the character direction of
the user's active input mode on iOS, after inserting a new paragraph. To achieve this, we use the
content view's `textInputMode.primaryLanguage` to compute `directionFromCurrentInputMode`, and send
it through `InsertTextOptions` to the web process. If we're inserting only a newline and the
selection is a caret, then we adjust the base writing direction to match the incoming
`directionFromCurrentInputMode`.

* LayoutTests/editing/input/ios/update-writing-direction-after-inserting-newline-expected.txt: Added.
* LayoutTests/editing/input/ios/update-writing-direction-after-inserting-newline.html: Added.

Add a layout test to exercise this change.

* Source/WebKit/Shared/Cocoa/InsertTextOptions.h:
* Source/WebKit/Shared/Cocoa/InsertTextOptions.serialization.in:

Add an optional `directionFromCurrentInputMode` member to `InsertTextOptions`.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView insertText:]):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::insertTextAsync):

See description above for more details.

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