Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information