Title: [274796] trunk
- Revision
- 274796
- Author
- [email protected]
- Date
- 2021-03-22 13:58:24 -0700 (Mon, 22 Mar 2021)
Log Message
[iOS] Composition text is not initially highlighted when typing in text fields using Pinyin keyboard
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (274795 => 274796)
--- trunk/LayoutTests/ChangeLog 2021-03-22 20:53:41 UTC (rev 274795)
+++ trunk/LayoutTests/ChangeLog 2021-03-22 20:58:24 UTC (rev 274796)
@@ -1,3 +1,16 @@
+2021-03-22 Wenson Hsieh <[email protected]>
+
+ [iOS] Composition text is not initially highlighted when typing in text fields using Pinyin keyboard
+ https://bugs.webkit.org/show_bug.cgi?id=223563
+ <rdar://problem/75564516>
+
+ Reviewed by Antti Koivisto.
+
+ 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.
+
2021-03-22 Chris Dumez <[email protected]>
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html is failing
Added: trunk/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html (0 => 274796)
--- trunk/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html 2021-03-22 20:58:24 UTC (rev 274796)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+input {
+ font-size: 20px;
+ outline: none;
+ caret-color: transparent;
+}
+</style>
+</head>
+<body>
+<input autofocus type="search" value="foo"></input>
+<p class="description">This test verifies that composition underlines are visible setting marked text in a search field.</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/editing/input/composition-underline-in-search-field.html (0 => 274796)
--- trunk/LayoutTests/editing/input/composition-underline-in-search-field.html (rev 0)
+++ trunk/LayoutTests/editing/input/composition-underline-in-search-field.html 2021-03-22 20:58:24 UTC (rev 274796)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+input {
+ font-size: 20px;
+ outline: none;
+ caret-color: transparent;
+}
+</style>
+</head>
+<body>
+<input autofocus type="search"></input>
+<p class="description">This test verifies that composition underlines are visible setting marked text in a search field.</p>
+<script>
+addEventListener("load", () => {
+ if (window.textInputController)
+ textInputController.setMarkedText("foo", 3, 3);
+});
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (274795 => 274796)
--- trunk/Source/WebCore/ChangeLog 2021-03-22 20:53:41 UTC (rev 274795)
+++ trunk/Source/WebCore/ChangeLog 2021-03-22 20:58:24 UTC (rev 274796)
@@ -1,3 +1,29 @@
+2021-03-22 Wenson Hsieh <[email protected]>
+
+ [iOS] Composition text is not initially highlighted when typing in text fields using Pinyin keyboard
+ https://bugs.webkit.org/show_bug.cgi?id=223563
+ <rdar://problem/75564516>
+
+ Reviewed by Antti Koivisto.
+
+ 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):
+
2021-03-22 Chris Dumez <[email protected]>
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html is failing
Modified: trunk/Source/WebCore/editing/Editor.cpp (274795 => 274796)
--- trunk/Source/WebCore/editing/Editor.cpp 2021-03-22 20:53:41 UTC (rev 274795)
+++ trunk/Source/WebCore/editing/Editor.cpp 2021-03-22 20:58:24 UTC (rev 274796)
@@ -88,6 +88,7 @@
#include "Range.h"
#include "RemoveFormatCommand.h"
#include "RenderBlock.h"
+#include "RenderBlockFlow.h"
#include "RenderLayer.h"
#include "RenderTextControl.h"
#include "RenderedDocumentMarker.h"
@@ -130,6 +131,10 @@
#include "PromisedAttachmentInfo.h"
#endif
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "LayoutIntegrationLineLayout.h"
+#endif
+
namespace WebCore {
static bool dispatchBeforeInputEvent(Element& element, const AtomString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { }, Event::IsCancelable cancelable = Event::IsCancelable::Yes)
@@ -2139,9 +2144,15 @@
highlight.startOffset += baseOffset;
highlight.endOffset += baseOffset;
}
- if (baseNode->renderer())
- baseNode->renderer()->repaint();
+ if (auto renderer = baseNode->renderer()) {
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto lineLayout = LayoutIntegration::LineLayout::containing(*renderer))
+ lineLayout->flow().ensureLineBoxes();
+#endif
+ renderer->repaint();
+ }
+
unsigned start = std::min(baseOffset + selectionStart, extentOffset);
unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
auto range = SimpleRange { { *baseNode, start }, { *baseNode, end } };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes