[webkit-changes] [WebKit/WebKit] 4079ed: [Writing Tools] Undoing (cmd + z) after a rewrite ...

Richard Robinson noreply at github.com
Tue Aug 27 19:35:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4079ede8dbe52bb9d41ba90d6d316dd72d497295
      https://github.com/WebKit/WebKit/commit/4079ede8dbe52bb9d41ba90d6d316dd72d497295
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-08-27 (Tue, 27 Aug 2024)

  Changed paths:
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/page/writing-tools/WritingToolsController.mm
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Undoing (cmd + z) after a rewrite displays multiples of the text
https://bugs.webkit.org/show_bug.cgi?id=278750
rdar://132887398

Reviewed by Abrar Rahman Protyasha.

When clicking "Show Rewrite", a redo operation is effectively done within WritingToolsController.
However, since this is not an actual redo and it just re-applies the command itself, a new undo
step ends up getting added erroneously within `WebEditorClient::registerUndoStep`. This is because
`m_page->isInRedo()` is `false`, when it should be true.

Fix by ensuring the page is "in redo" when the WTC reapplies the command.

Drive-by fix: Remove an incorrect assertion in WTC.

* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::setIsInRedo):
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::showSelection const):
(WebCore::WritingToolsController::showRewrittenCompositionForSession):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setIsInRedo):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reapplyEditCommand):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::setIsInRedo):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, CompositionWithMultipleUndoAfterEndingAfterShowOriginalAndRewritten)):

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