https://bugs.webkit.org/show_bug.cgi?id=223563
<rdar://problem/75564516>
Reviewed by Antti Koivisto.
Source/WebCore:
When enabling line layout integration, composition highlights on iOS don't appear when typing an input string
using the Pinyin keyboard for the first time. This is because the text renderer for the inserted composition
text does not contain inline text boxes when painting the composition text on iOS, so the marked text painting
codepath is never triggered.
On macOS, this isn't an issue because the process of setting the composition changes the selection, which then
changes the highlight state of the `RenderText`, which subsequently calls into `ensureLineBoxes()`. However,
since selections are drawn using UIKit in the UI process on iOS, we don't end up ensuring that inline text boxes
are constructed for the inserted text.
To address this, we follow macOS behavior by ensuring line box construction on the rendered composition text
when setting the composition.
Test: editing/input/composition-underline-in-search-field.html
* editing/Editor.cpp:
(WebCore::Editor::setComposition):
LayoutTests:
Add a test to verify that marked text underlines show up in search fields.
* editing/input/composition-underline-in-search-field-expected-mismatch.html: Added.
* editing/input/composition-underline-in-search-field.html: Added.
Canonical link: https://commits.webkit.org/235598@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274796 268f45cc-cd09-0410-ab3c-d52691b4dbfc