[webkit-changes] [WebKit/WebKit] 78c0b4: [Writing Tools] Rewrite and other Writing Tools fu...

Richard Robinson noreply at github.com
Tue Sep 17 10:16:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 78c0b4e870659a7382d1d77b8c3efa5c18bef475
      https://github.com/WebKit/WebKit/commit/78c0b4e870659a7382d1d77b8c3efa5c18bef475
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

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

  Log Message:
  -----------
  [Writing Tools] Rewrite and other Writing Tools functions may rarely fail when selecting specific types of complex content in Safari
https://bugs.webkit.org/show_bug.cgi?id=279791
rdar://135890006

Reviewed by Aditya Keerthi.

Certain types of HTML content may result in a node which contains text but which does not have a renderer,
such as when there is an omit-able trailing newline in flex content. Currently, the attributed string logic
skips over these cases, but iterating with TextIterator does not. This results in mismatched range lengths.

Fix by having the attributed string logic not skip these cases and match the TextIterator behavior. To reduce
risk, only apply this change when the corresponding option is specified.

Add a test for this.

Drive-by fix: Clean up another test by removing some duplicated code.

* Source/WebCore/editing/cocoa/HTMLConverter.h:
* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(hasAncestorQualifyingForWritingToolsPreservation):
(setAttributesWithStyle):
(WebCore::editingAttributedString):
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::willBeginWritingToolsSession):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, SuggestedTextIsSelectedAfterSmartReply)):
(TEST(WritingTools, CompositionWithOmittedTrailingWhitespaceContent)):

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