Title: [274834] branches/safari-611.1.21.0-branch
Revision
274834
Author
[email protected]
Date
2021-03-22 18:02:56 -0700 (Mon, 22 Mar 2021)

Log Message

Cherry-pick r274796. rdar://problem/75712824

    [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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274796 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog (274833 => 274834)


--- branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog	2021-03-23 01:02:51 UTC (rev 274833)
+++ branches/safari-611.1.21.0-branch/LayoutTests/ChangeLog	2021-03-23 01:02:56 UTC (rev 274834)
@@ -1,3 +1,55 @@
+2021-03-22  Russell Epstein  <[email protected]>
+
+        Cherry-pick r274796. rdar://problem/75712824
+
+    [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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-04  Alan Coon  <[email protected]>
 
         Cherry-pick r273901. rdar://problem/75058982

Added: branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html (0 => 274834)


--- branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field-expected-mismatch.html	2021-03-23 01:02:56 UTC (rev 274834)
@@ -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: branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field.html (0 => 274834)


--- branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field.html	                        (rev 0)
+++ branches/safari-611.1.21.0-branch/LayoutTests/editing/input/composition-underline-in-search-field.html	2021-03-23 01:02:56 UTC (rev 274834)
@@ -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: branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog (274833 => 274834)


--- branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog	2021-03-23 01:02:51 UTC (rev 274833)
+++ branches/safari-611.1.21.0-branch/Source/WebCore/ChangeLog	2021-03-23 01:02:56 UTC (rev 274834)
@@ -1,3 +1,68 @@
+2021-03-22  Russell Epstein  <[email protected]>
+
+        Cherry-pick r274796. rdar://problem/75712824
+
+    [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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-17  Ruben Turcios  <[email protected]>
 
         Cherry-pick r274573. rdar://problem/75538213

Modified: branches/safari-611.1.21.0-branch/Source/WebCore/editing/Editor.cpp (274833 => 274834)


--- branches/safari-611.1.21.0-branch/Source/WebCore/editing/Editor.cpp	2021-03-23 01:02:51 UTC (rev 274833)
+++ branches/safari-611.1.21.0-branch/Source/WebCore/editing/Editor.cpp	2021-03-23 01:02:56 UTC (rev 274834)
@@ -87,6 +87,7 @@
 #include "Range.h"
 #include "RemoveFormatCommand.h"
 #include "RenderBlock.h"
+#include "RenderBlockFlow.h"
 #include "RenderLayer.h"
 #include "RenderTextControl.h"
 #include "RenderedDocumentMarker.h"
@@ -129,6 +130,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)
@@ -2135,9 +2140,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

Reply via email to