[webkit-changes] [WebKit/WebKit] 316776: [Writing Suggestions] Prediction sometimes appears...

Wenson Hsieh noreply at github.com
Wed May 15 16:11:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 316776c063a7e94ad008c5c9db5fa78b801d7824
      https://github.com/WebKit/WebKit/commit/316776c063a7e94ad008c5c9db5fa78b801d7824
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-05-15 (Wed, 15 May 2024)

  Changed paths:
    A LayoutTests/editing/input/mac/writing-suggestions-in-anonymous-renderer-expected.html
    A LayoutTests/editing/input/mac/writing-suggestions-in-anonymous-renderer.html
    M Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp

  Log Message:
  -----------
  [Writing Suggestions] Prediction sometimes appears at the end of the document in Mail compose
https://bugs.webkit.org/show_bug.cgi?id=274223
rdar://128109513

Reviewed by Richard Robinson.

Writing suggestions are still sometimes inserted in the wrong place in the render tree. This happens
under these conditions:

1.  The text node before the caret selection is inside of an anonymous renderer.
2.  There are one or more renderers that come after the text node's renderer in tree order, that are
    descendants of the element that contains the text node.

This is one concrete example, wherein an anonymous block-level renderer is added to contain a single
text node directly underneath the `body`:

```
<body renderer>
    <anonymous renderer>
        <text renderer> // this is the node before suggestions
        * // writing suggestions are supposed to be inserted here
    <any other renderer>
    …
    * // writing suggestions are inserted here instead
```

To fix this, we simply adjust the logic in `updateWritingSuggestionsRenderer` to insert the
generated writing suggestions renderer inside of the text node's parent, such that it's always
the next sibling of the text node.

* LayoutTests/editing/input/mac/writing-suggestions-in-anonymous-renderer-expected.html: Added.
* LayoutTests/editing/input/mac/writing-suggestions-in-anonymous-renderer.html: Added.

Add another layout test to exercise this change.

* Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateWritingSuggestionsRenderer):

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