[webkit-changes] [WebKit/WebKit] 292bb3: [Writing Tools] Make Table: Mail: Generated table ...

Richard Robinson noreply at github.com
Fri Aug 2 16:40:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 292bb3d0d677c5d7d39dde27b8b141d54f779b35
      https://github.com/WebKit/WebKit/commit/292bb3d0d677c5d7d39dde27b8b141d54f779b35
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-08-02 (Fri, 02 Aug 2024)

  Changed paths:
    M Source/WebCore/editing/CompositeEditCommand.cpp
    M Source/WebCore/editing/CompositeEditCommand.h
    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] Make Table: Mail: Generated table has extra borderlines
https://bugs.webkit.org/show_bug.cgi?id=276315
rdar://129926389

Reviewed by Aditya Keerthi.

When `didReceiveText` is invoked multiple times when replacing text with a table, multiple table
elements were being created. This is because when the controller tries to re-create the context range
after the first table, it is unable to do so since selections cannot encompass a table or list element.

Fix by not trying to re-create the context range at all; instead, just undo the previous replacements,
and then the context range will always just be the original range for the current composition.

To facilitate this, add a 'silent' option when undo-ing a composition edit command so that a command can
be undone without adding it to the undo stack or emitting any type of event.

Additionally, since the TextAnimationController currently relies on being able to get the current range using
the session identifier, add a new property to the Writing Tools command to give this information.

* Source/WebCore/editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::unapply):
* Source/WebCore/editing/CompositeEditCommand.h:
* Source/WebCore/editing/WritingToolsCompositionCommand.cpp:
(WebCore::WritingToolsCompositionCommand::WritingToolsCompositionCommand):
(WebCore::WritingToolsCompositionCommand::replaceContentsOfRangeWithFragment):
* Source/WebCore/editing/WritingToolsCompositionCommand.h:
(WebCore::WritingToolsCompositionCommand::currentContextRange const):
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::compositionSessionDidReceiveTextWithReplacementRange):
(WebCore::WritingToolsController::contextRangeForSessionWithID const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(makeTableAttributedString):
(TEST(WritingTools, CompositionWithTable)):
(TEST(WritingTools, SmartReplyWithInsertedSpace)):

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