Title: [208406] trunk
Revision
208406
Author
[email protected]
Date
2016-11-04 16:55:00 -0700 (Fri, 04 Nov 2016)

Log Message

Safari does not emit composition end if blurred for dead key / Japanese IME
https://bugs.webkit.org/show_bug.cgi?id=164369
<rdar://problem/29050439>

Reviewed by Ryosuke Niwa.

Source/WebCore:

On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
This is because the focused element may have changed after performing the selection change, so we would
otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
of the element with the composition.

Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
that discards the marked text, and then updates the editor state. This patch splits this into two separate
steps -- see the WebKit2 ChangeLog for more details.

Test: fast/events/ime-compositionend-on-selection-change.html

* editing/Editor.cpp:
(WebCore::Editor::selectionWillChange):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
* editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
* loader/EmptyClients.h:
* page/EditorClient.h:

Source/WebKit/mac:

When canceling a composition, make sure that we clear the system IME state.

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::canceledComposition):

Source/WebKit/win:

Add a stub implementation of canceledComposition.

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::canceledComposition):
* WebCoreSupport/WebEditorClient.h:

Source/WebKit2:

Split WebPage::discardedComposition into two steps, where we first discard marked text and then update the
editor state. This allows the codepath where we cancel the composition early (before setting the selection) to
discard marked text without also forcing an editor state update at the same time. The editor state is later
updated in WebPage::didChangeSelection.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::compositionWasCanceled):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::canceledComposition):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):
(WebKit::WebPage::discardedComposition):
(WebKit::WebPage::canceledComposition):
* WebProcess/WebPage/WebPage.h:

LayoutTests:

Adds a new test verifying that we dispatch `compositionend` events in various circumstances:
    1. After composing in an editable area and then focusing another editable area.
    2. After composing in an editable area and then blur()-ing.
    3. After composing in an editable area and then changing the selection.

There should be no behavior change for other platforms, so no new tests are needed there with this change.

* fast/events/ime-compositionend-on-selection-change-expected.txt: Added.
* fast/events/ime-compositionend-on-selection-change.html: Added.
* platform/ios-simulator/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208405 => 208406)


--- trunk/LayoutTests/ChangeLog	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/LayoutTests/ChangeLog	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1,3 +1,22 @@
+2016-11-04  Wenson Hsieh  <[email protected]>
+
+        Safari does not emit composition end if blurred for dead key / Japanese IME
+        https://bugs.webkit.org/show_bug.cgi?id=164369
+        <rdar://problem/29050439>
+
+        Reviewed by Ryosuke Niwa.
+
+        Adds a new test verifying that we dispatch `compositionend` events in various circumstances:
+            1. After composing in an editable area and then focusing another editable area.
+            2. After composing in an editable area and then blur()-ing.
+            3. After composing in an editable area and then changing the selection.
+
+        There should be no behavior change for other platforms, so no new tests are needed there with this change.
+
+        * fast/events/ime-compositionend-on-selection-change-expected.txt: Added.
+        * fast/events/ime-compositionend-on-selection-change.html: Added.
+        * platform/ios-simulator/TestExpectations:
+
 2016-11-04  Brady Eidson  <[email protected]>
 
         IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.

Added: trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change-expected.txt (0 => 208406)


--- trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change-expected.txt	2016-11-04 23:55:00 UTC (rev 208406)
@@ -0,0 +1,21 @@
+To manually test, start editing a composition in the input field and focus the contenteditable without committing the composition. A compositionend event should be logged, with the event target being the input field. Next, insert a pending composition in the contenteditable and focus the input. A compositionend should be logged, with the event target being the contenteditable. Then insert a pending composition in the input field and focus the document. A compositionend event should be logged with the target being the input field. Lastly, insert a pending composition in the rich contenteditable and click and drag to select all the text in the contenteditable. A compositionend event should be fired on the contenteditable.
+
+
+defb
+
+1. Editing the plain input field
+Focusing the rich contenteditable
+PASS: Dispatched compositionend on <INPUT id="plain">
+
+2. Editing the rich contenteditable
+Focusing the plain input field
+PASS: Dispatched compositionend on <DIV id="rich">
+
+3. Editing the plain input field again
+Blurring the plain input field
+PASS: Dispatched compositionend on <INPUT id="plain">
+
+4. Editing the rich contenteditable again
+Changing selection within the rich contenteditable
+PASS: Dispatched compositionend on <DIV id="rich">
+

Added: trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change.html (0 => 208406)


--- trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ime-compositionend-on-selection-change.html	2016-11-04 23:55:00 UTC (rev 208406)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>To manually test, start editing a composition in the input field and focus the contenteditable without committing
+    the composition. A compositionend event should be logged, with the event target being the input field. Next, insert
+    a pending composition in the contenteditable and focus the input. A compositionend should be logged, with the event
+    target being the contenteditable. Then insert a pending composition in the input field and focus the document. A
+    compositionend event should be logged with the target being the input field. Lastly, insert a pending composition in
+    the rich contenteditable and click and drag to select all the text in the contenteditable. A compositionend event
+    should be fired on the contenteditable.</p>
+    <input id="plain"></input>
+    <div id="rich" contenteditable style="border: 1px dashed"></div>
+    <div id="output"></div>
+    <script type="text/_javascript_">
+        let write = s => output.innerHTML += `${s}<br>`;
+        plain.addEventListener("compositionend", logCompositionEnd);
+        rich.addEventListener("compositionend", logCompositionEnd);
+        plain.focus();
+
+        if (window.testRunner && window.textInputController) {
+            testRunner.dumpAsText();
+
+            write("");
+            write("1. Editing the plain input field");
+            textInputController.setMarkedText("a", 1, 0);
+            write("   Focusing the rich contenteditable");
+            rich.focus();
+
+            write("");
+            write("2. Editing the rich contenteditable");
+            textInputController.setMarkedText("b", 1, 0);
+            write("   Focusing the plain input field");
+            plain.focus();
+
+            write("");
+            write("3. Editing the plain input field again");
+            textInputController.setMarkedText("c", 1, 0);
+            write("   Blurring the plain input field");
+            plain.blur();
+
+            write("");
+            write("4. Editing the rich contenteditable again");
+            rich.focus();
+            textInputController.setMarkedText("d", 1, 0);
+            textInputController.setMarkedText("de", 2, 0);
+            textInputController.setMarkedText("def", 3, 0);
+            write("   Changing selection within the rich contenteditable");
+            document.execCommand("SelectAll");
+        }
+
+        function logCompositionEnd(event)
+        {
+            write(`PASS: Dispatched compositionend on &lt;${event.target.tagName} id="${event.target.id}"&gt;`);
+        }
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (208405 => 208406)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1200,6 +1200,7 @@
 fast/events/frame-scroll-fake-mouse-move.html [ Failure ]
 fast/events/frame-tab-focus.html [ Failure ]
 fast/events/ime-composition-events-001.html [ Failure ]
+fast/events/ime-compositionend-on-selection-change.html [ Failure ]
 fast/events/inputText-never-fired-on-keydown-cancel.html [ Failure ]
 fast/events/input-events-drag-and-drop.html [ Failure ]
 fast/events/input-events-insert-by-drop.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (208405 => 208406)


--- trunk/Source/WebCore/ChangeLog	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/ChangeLog	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1,3 +1,35 @@
+2016-11-04  Wenson Hsieh  <[email protected]>
+
+        Safari does not emit composition end if blurred for dead key / Japanese IME
+        https://bugs.webkit.org/show_bug.cgi?id=164369
+        <rdar://problem/29050439>
+
+        Reviewed by Ryosuke Niwa.
+
+        On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
+        This is because the focused element may have changed after performing the selection change, so we would
+        otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
+        of the element with the composition.
+
+        Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
+        clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
+        calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
+        accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
+        that discards the marked text, and then updates the editor state. This patch splits this into two separate
+        steps -- see the WebKit2 ChangeLog for more details.
+
+        Test: fast/events/ime-compositionend-on-selection-change.html
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::selectionWillChange):
+        * editing/Editor.h:
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::selectionWillChange):
+        * loader/EmptyClients.h:
+        * page/EditorClient.h:
+
 2016-11-04  Brady Eidson  <[email protected]>
 
         IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.

Modified: trunk/Source/WebCore/editing/Editor.cpp (208405 => 208406)


--- trunk/Source/WebCore/editing/Editor.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/editing/Editor.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -3244,6 +3244,12 @@
     document().markers().repaintMarkers(DocumentMarker::TextMatch);
 }
 
+#if !PLATFORM(MAC)
+void Editor::selectionWillChange()
+{
+}
+#endif
+
 void Editor::respondToChangedSelection(const VisibleSelection&, FrameSelection::SetSelectionOptions options)
 {
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/editing/Editor.h (208405 => 208406)


--- trunk/Source/WebCore/editing/Editor.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/editing/Editor.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -390,6 +390,7 @@
 
     WEBCORE_EXPORT IntRect firstRectForRange(Range*) const;
 
+    void selectionWillChange();
     void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
     WEBCORE_EXPORT void updateEditorUINowIfScheduled();
     bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (208405 => 208406)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -305,6 +305,10 @@
         clearTypingStyle();
 
     VisibleSelection oldSelection = m_selection;
+    bool didMutateSelection = oldSelection != newSelection;
+    if (didMutateSelection)
+        m_frame->editor().selectionWillChange();
+
     m_selection = newSelection;
 
     // Selection offsets should increase when LF is inserted before the caret in InsertLineBreakCommand. See <https://webkit.org/b/56061>.
@@ -311,7 +315,7 @@
     if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(newSelection.start()))
         textControl->selectionChanged(options & FireSelectEvent);
 
-    if (oldSelection == newSelection)
+    if (!didMutateSelection)
         return false;
 
     setCaretRectNeedsUpdate();

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (208405 => 208406)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2016-11-04 23:55:00 UTC (rev 208406)
@@ -428,6 +428,15 @@
     pasteboardURL.userVisibleForm = client()->userVisibleString(pasteboardURL.url);
 }
 
+void Editor::selectionWillChange()
+{
+    if (!hasComposition() || ignoreCompositionSelectionChange() || m_frame.selection().isNone())
+        return;
+
+    cancelComposition();
+    client()->canceledComposition();
+}
+
 String Editor::plainTextFromPasteboard(const PasteboardPlainText& text)
 {
     String string = text.text;

Modified: trunk/Source/WebCore/loader/EmptyClients.h (208405 => 208406)


--- trunk/Source/WebCore/loader/EmptyClients.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -468,6 +468,7 @@
     void didChangeSelectionAndUpdateLayout() override { }
     void updateEditorStateAfterLayoutIfEditabilityChanged() override { }
     void discardedComposition(Frame*) override { }
+    void canceledComposition() override { }
     void didEndEditing() override { }
     void willWriteSelectionToPasteboard(Range*) override { }
     void didWriteSelectionToPasteboard() override { }

Modified: trunk/Source/WebCore/page/EditorClient.h (208405 => 208406)


--- trunk/Source/WebCore/page/EditorClient.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebCore/page/EditorClient.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -102,6 +102,7 @@
     // Notify an input method that a composition was voluntarily discarded by WebCore, so that it could clean up too.
     // This function is not called when a composition is closed per a request from an input method.
     virtual void discardedComposition(Frame*) = 0;
+    virtual void canceledComposition() = 0;
 
     virtual void registerUndoStep(PassRefPtr<UndoStep>) = 0;
     virtual void registerRedoStep(PassRefPtr<UndoStep>) = 0;

Modified: trunk/Source/WebKit/mac/ChangeLog (208405 => 208406)


--- trunk/Source/WebKit/mac/ChangeLog	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1,3 +1,17 @@
+2016-11-04  Wenson Hsieh  <[email protected]>
+
+        Safari does not emit composition end if blurred for dead key / Japanese IME
+        https://bugs.webkit.org/show_bug.cgi?id=164369
+        <rdar://problem/29050439>
+
+        Reviewed by Ryosuke Niwa.
+
+        When canceling a composition, make sure that we clear the system IME state.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::canceledComposition):
+
 2016-11-04  Said Abou-Hallawa  <[email protected]>
 
         Add a setting and preferences to enable/disable async image decoding

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (208405 => 208406)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -113,6 +113,7 @@
     void didChangeSelectionAndUpdateLayout() final { }
     void updateEditorStateAfterLayoutIfEditabilityChanged() final;
     void discardedComposition(WebCore::Frame*) final;
+    void canceledComposition() final;
 
     void registerUndoStep(PassRefPtr<WebCore::UndoStep>) final;
     void registerRedoStep(PassRefPtr<WebCore::UndoStep>) final;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (208405 => 208406)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-11-04 23:55:00 UTC (rev 208406)
@@ -375,6 +375,13 @@
     // The effects of this function are currently achieved via -[WebHTMLView _updateSelectionForInputManager].
 }
 
+void WebEditorClient::canceledComposition()
+{
+#if !PLATFORM(IOS)
+    [[NSTextInputContext currentInputContext] discardMarkedText];
+#endif
+}
+
 void WebEditorClient::didEndEditing()
 {
 #if !PLATFORM(IOS)

Modified: trunk/Source/WebKit/win/ChangeLog (208405 => 208406)


--- trunk/Source/WebKit/win/ChangeLog	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/win/ChangeLog	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1,3 +1,17 @@
+2016-11-04  Wenson Hsieh  <[email protected]>
+
+        Safari does not emit composition end if blurred for dead key / Japanese IME
+        https://bugs.webkit.org/show_bug.cgi?id=164369
+        <rdar://problem/29050439>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a stub implementation of canceledComposition.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::canceledComposition):
+        * WebCoreSupport/WebEditorClient.h:
+
 2016-11-04  Per Arne Vollan  <[email protected]>
 
         [Win] Page visibility tests are timing out.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp (208405 => 208406)


--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -242,6 +242,11 @@
     notImplemented();
 }
 
+void WebEditorClient::canceledComposition()
+{
+    notImplemented();
+}
+
 void WebEditorClient::didEndEditing()
 {
     static _bstr_t webViewDidEndEditingNotificationName(WebViewDidEndEditingNotification);

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h (208405 => 208406)


--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -58,6 +58,7 @@
     virtual void respondToChangedSelection(WebCore::Frame*);
     void didChangeSelectionAndUpdateLayout() final { }
     void updateEditorStateAfterLayoutIfEditabilityChanged() final { } 
+    void canceledComposition() final;
     void discardedComposition(WebCore::Frame*) final;
 
     bool shouldDeleteRange(WebCore::Range*);

Modified: trunk/Source/WebKit2/ChangeLog (208405 => 208406)


--- trunk/Source/WebKit2/ChangeLog	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1,3 +1,29 @@
+2016-11-04  Wenson Hsieh  <[email protected]>
+
+        Safari does not emit composition end if blurred for dead key / Japanese IME
+        https://bugs.webkit.org/show_bug.cgi?id=164369
+        <rdar://problem/29050439>
+
+        Reviewed by Ryosuke Niwa.
+
+        Split WebPage::discardedComposition into two steps, where we first discard marked text and then update the
+        editor state. This allows the codepath where we cancel the composition early (before setting the selection) to
+        discard marked text without also forcing an editor state update at the same time. The editor state is later
+        updated in WebPage::didChangeSelection.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::compositionWasCanceled):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::canceledComposition):
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didChangeSelection):
+        (WebKit::WebPage::discardedComposition):
+        (WebKit::WebPage::canceledComposition):
+        * WebProcess/WebPage/WebPage.h:
+
 2016-11-04  Alex Christensen  <[email protected]>
 
         Unreviewed, rolling out r208293.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208405 => 208406)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -4379,12 +4379,11 @@
     count = m_backForwardList->forwardListCount();
 }
 
-void WebPageProxy::compositionWasCanceled(const EditorState& editorState)
+void WebPageProxy::compositionWasCanceled()
 {
 #if PLATFORM(COCOA)
     m_pageClient.notifyInputContextAboutDiscardedComposition();
 #endif
-    editorStateChanged(editorState);
 }
 
 // Undo management

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (208405 => 208406)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -1320,7 +1320,7 @@
 #endif
 
     void editorStateChanged(const EditorState&);
-    void compositionWasCanceled(const EditorState&);
+    void compositionWasCanceled();
     void setHasHadSelectionChangesFromUserInteraction(bool);
     void setNeedsHiddenContentEditableQuirk(bool);
     void setNeedsPlainTextQuirk(bool);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (208405 => 208406)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-11-04 23:55:00 UTC (rev 208406)
@@ -240,7 +240,7 @@
 
     # Editor notifications
     EditorStateChanged(struct WebKit::EditorState editorState)
-    CompositionWasCanceled(struct WebKit::EditorState editorState)
+    CompositionWasCanceled()
     SetHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
     SetNeedsHiddenContentEditableQuirk(bool needsHiddenContentEditableQuirk)
     SetNeedsPlainTextQuirk(bool needsPlainTextQuirk)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (208405 => 208406)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -211,6 +211,11 @@
     m_page->discardedComposition();
 }
 
+void WebEditorClient::canceledComposition()
+{
+    m_page->canceledComposition();
+}
+
 void WebEditorClient::didEndEditing()
 {
     static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification"));

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (208405 => 208406)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -65,6 +65,7 @@
     void didChangeSelectionAndUpdateLayout() final;
     void updateEditorStateAfterLayoutIfEditabilityChanged() final;
     void discardedComposition(WebCore::Frame*) final;
+    void canceledComposition() final;
     void didEndEditing() final;
     void willWriteSelectionToPasteboard(WebCore::Range*) final;
     void didWriteSelectionToPasteboard() final;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208405 => 208406)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-04 23:55:00 UTC (rev 208406)
@@ -4898,7 +4898,7 @@
     // FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
     if (frame.editor().hasComposition() && !frame.editor().ignoreCompositionSelectionChange() && !frame.selection().isNone()) {
         frame.editor().cancelComposition();
-        send(Messages::WebPageProxy::CompositionWasCanceled(editorState));
+        discardedComposition();
     } else
         send(Messages::WebPageProxy::EditorStateChanged(editorState));
 #else
@@ -4983,9 +4983,15 @@
 
 void WebPage::discardedComposition()
 {
-    send(Messages::WebPageProxy::CompositionWasCanceled(editorState()));
+    send(Messages::WebPageProxy::CompositionWasCanceled());
+    send(Messages::WebPageProxy::EditorStateChanged(editorState()));
 }
 
+void WebPage::canceledComposition()
+{
+    send(Messages::WebPageProxy::CompositionWasCanceled());
+}
+
 void WebPage::setMinimumLayoutSize(const IntSize& minimumLayoutSize)
 {
     if (m_minimumLayoutSize == minimumLayoutSize)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (208405 => 208406)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-11-04 23:27:19 UTC (rev 208405)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-11-04 23:55:00 UTC (rev 208406)
@@ -659,6 +659,7 @@
     void didApplyStyle();
     void didChangeSelection();
     void discardedComposition();
+    void canceledComposition();
 
 #if PLATFORM(COCOA)
     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to