[webkit-changes] [WebKit/WebKit] f86d34: [Writing Tools] Smart replies are not inserted int...
Richard Robinson
noreply at github.com
Fri Jul 5 17:01:54 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f86d3400c875519b3f3c368f1ea9a37ed8a1d11b
https://github.com/WebKit/WebKit/commit/f86d3400c875519b3f3c368f1ea9a37ed8a1d11b
Author: Richard Robinson <richard_robinson2 at apple.com>
Date: 2024-07-05 (Fri, 05 Jul 2024)
Changed paths:
M Source/WebCore/editing/WritingToolsCompositionCommand.cpp
M Source/WebCore/editing/WritingToolsCompositionCommand.h
M Source/WebCore/page/writing-tools/WritingToolsController.h
M Source/WebCore/page/writing-tools/WritingToolsController.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm
Log Message:
-----------
[Writing Tools] Smart replies are not inserted into Mail
https://bugs.webkit.org/show_bug.cgi?id=276273
rdar://131083006
Reviewed by Aditya Keerthi.
UIKit and AppKit behave different with regards to how they use the Writing Tools delegate methods
for the smart replies use case; with UIKit, UIKit inserts a space into the document prior to the
`willBegin` call, and subsequently removes the space prior to the `didReceiveText` call. As a result,
the initial session range created will now be invalid.
This was not a problem previously as live ranges were being used, which incidentally made this work as-is.
However, with the move to using `SimpleRange`s, this no longer happens.
Fix by re-computing the session range the first time `didReceiveText` is called so that it has the correct
session range. This will just be a temporary fix until UIKit changes behavior to no longer insert the space.
* Source/WebCore/editing/WritingToolsCompositionCommand.cpp:
(WebCore::WritingToolsCompositionCommand::replaceContentsOfRangeWithFragment):
* Source/WebCore/editing/WritingToolsCompositionCommand.h:
(WebCore::WritingToolsCompositionCommand::setEndingContextRange):
* Source/WebCore/page/writing-tools/WritingToolsController.h:
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::compositionSessionDidReceiveTextWithReplacementRange):
(WebCore::WritingToolsController::writingToolsSessionDidReceiveAction<WritingTools::Session::Type::Proofreading>): Deleted.
(WebCore::WritingToolsController::writingToolsSessionDidReceiveAction<WritingTools::Session::Type::Composition>): Deleted.
(WebCore::WritingToolsController::writingToolsSessionDidReceiveAction): Deleted.
(WebCore::WritingToolsController::didEndWritingToolsSession<WritingTools::Session::Type::Proofreading>): Deleted.
(WebCore::WritingToolsController::didEndWritingToolsSession<WritingTools::Session::Type::Composition>): Deleted.
(WebCore::WritingToolsController::didEndWritingToolsSession): Deleted.
(WebCore::WritingToolsController::updateStateForSelectedSuggestionIfNeeded): Deleted.
(WebCore::appliedCommandIsWritingToolsCommand): Deleted.
(WebCore::WritingToolsController::respondToUnappliedEditing): Deleted.
(WebCore::WritingToolsController::respondToReappliedEditing): Deleted.
(WebCore::WritingToolsController::contextRangeForSessionWithID const): Deleted.
(WebCore::WritingToolsController::stateForSession): Deleted.
(WebCore::WritingToolsController::document const): Deleted.
(WebCore::WritingToolsController::showOriginalCompositionForSession): Deleted.
(WebCore::WritingToolsController::showRewrittenCompositionForSession): Deleted.
(WebCore::WritingToolsController::restartCompositionForSession): Deleted.
(WebCore::WritingToolsController::findTextSuggestionMarkerByID const): Deleted.
(WebCore::WritingToolsController::findTextSuggestionMarkerContainingRange const): Deleted.
(WebCore::WritingToolsController::replaceContentsOfRangeInSession): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, SmartReplyTest)):
Canonical link: https://commits.webkit.org/280703@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