[webkit-changes] [WebKit/WebKit] 13f63b: [Writing Tools] Compose query result in Mail is bl...

Aditya Keerthi noreply at github.com
Wed Oct 9 10:29:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 13f63b76f95da6b8fe035da365783fc1ce43039b
      https://github.com/WebKit/WebKit/commit/13f63b76f95da6b8fe035da365783fc1ce43039b
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-10-09 (Wed, 09 Oct 2024)

  Changed paths:
    M Source/WebCore/page/writing-tools/WritingToolsController.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Compose query result in Mail is blank text
https://bugs.webkit.org/show_bug.cgi?id=281122
rdar://137293491

Reviewed by Wenson Hsieh and Richard Robinson.

UIKit logic to insert text following a "Compose" query relies on a text
placeholder being successfully created.

WebKit only creates text placeholders if there is a non-null selection.
The selection is currently cleared downstream of
`-[WKWebView writingToolsSession:didReceiveAction:]`, when called with
`WTActionCompositionRestart`. Consequently, when UIKit goes to create a text
placeholder for a Compose query, a nil placeholder is returned.

"Compose" behavior is effectively the same as a "Smart Reply". It is not a
rewrite of text, but is simply creation of text. Additionally, they both
use text placeholder animations, and do not send a final, redundant
`didReceiveText:`.

Fix by treating "Compose" the same as smart replies for animation and selection
clearing purposes. This ensures that UIKit can create a text placeholder and
run their logic as expected. Additionally, WebKit now correctly elides the
pondering animation, and performs the final insertion animation.

* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::isZeroToOneCompositionType):
(WebCore::WritingToolsController::compositionSessionDidReceiveTextWithReplacementRange):

Ensure the final insertion animation is performed for "Compose".

(WebCore::WritingToolsController::restartCompositionForSession):

Do not clear the selection or start a pondering (initial) animation.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, SuggestedTextIsSelectedAfterCompose)):

This test is a modified version of SuggestedTextIsSelectedAfterSmartReply.

It previously failed due to a lack of successful text placeholder creation.

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