Title: [141479] trunk
Revision
141479
Author
[email protected]
Date
2013-01-31 13:50:17 -0800 (Thu, 31 Jan 2013)

Log Message

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Patch by Aurimas Liutikas <[email protected]> on 2013-01-31
Reviewed by Ryosuke Niwa.

Source/WebCore:

Chromium has a bug where the IME composition did not get cancelled on _javascript_ changes
to the focused editing field. Most of other WebKit ports were already doing this check
in their EditorClient::respondToChangedSelection. I took that logic and moved it to the
Editor so every port and use the same code.

An existing test editing/input/setting-input-value-cancel-ime-composition.html covers this change.
This test used to have an expectation to fail on Chromium and after this patch it will start passing.

* editing/Editor.cpp:
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
    Adding a call that can be used by any the port to cancel the composition if it's no longer valid.
(WebCore):
* editing/Editor.h:
(Editor):

Source/WebKit/chromium:

* public/WebViewClient.h:
(WebKit::WebViewClient::didCancelCompositionOnSelectionChange):
    Adding a callback to let the WebViewClient know that the composition has been cancelled.
* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::respondToChangedSelection):
    Adding a call composition if it is no longer valid.

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::respondToChangedSelection):
    Adding a call to the newly refactored method.

Source/WebKit/gtk:

* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::respondToChangedSelection):
    Adding a call to the newly refactored Editor method.

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateSelectionForInputManager]):

Source/WebKit/win:

* WebView.cpp:
(WebView::updateSelectionForIME):
    Adding a call to the newly refactored method.

LayoutTests:

* platform/chromium/TestExpectations: Removed fail expectation for the editing/input/setting-input-value-cancel-ime-composition.html since this patch fixes the bug https://bugs.webkit.org/show_bug.cgi?id=55560

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141478 => 141479)


--- trunk/LayoutTests/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/LayoutTests/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,12 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * platform/chromium/TestExpectations: Removed fail expectation for the editing/input/setting-input-value-cancel-ime-composition.html since this patch fixes the bug https://bugs.webkit.org/show_bug.cgi?id=55560
+
 2013-01-31  Rouslan Solomakhin  <[email protected]>
 
         [Chromium] Expect spellcheck to work for exactly-selected multi-word misspellings

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (141478 => 141479)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1105,8 +1105,6 @@
 # Selection is wrong.
 crbug.com/64938 editing/selection/5354455-1.html [ Failure ]
 
-webkit.org/b/55560 editing/input/setting-input-value-cancel-ime-composition.html [ Failure ]
-
 # New test added in r82159
 crbug.com/77706 editing/spelling/grammar.html [ Failure ]
 

Modified: trunk/Source/WebCore/ChangeLog (141478 => 141479)


--- trunk/Source/WebCore/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebCore/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,25 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        Chromium has a bug where the IME composition did not get cancelled on _javascript_ changes
+        to the focused editing field. Most of other WebKit ports were already doing this check
+        in their EditorClient::respondToChangedSelection. I took that logic and moved it to the
+        Editor so every port and use the same code.
+
+        An existing test editing/input/setting-input-value-cancel-ime-composition.html covers this change.
+        This test used to have an expectation to fail on Chromium and after this patch it will start passing.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
+            Adding a call that can be used by any the port to cancel the composition if it's no longer valid.
+        (WebCore):
+        * editing/Editor.h:
+        (Editor):
+
 2013-01-31  Joseph Pecoraro  <[email protected]>
 
         Disable ENABLE_FULLSCREEN_API on iOS

Modified: trunk/Source/WebCore/editing/Editor.cpp (141478 => 141479)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1343,6 +1343,17 @@
     setComposition(emptyString(), CancelComposition);
 }
 
+bool Editor::cancelCompositionIfSelectionIsInvalid()
+{
+    unsigned start;
+    unsigned end;
+    if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
+        return false;
+
+    cancelComposition();
+    return true;
+}
+
 void Editor::confirmComposition(const String& text)
 {
     setComposition(text, ConfirmComposition);

Modified: trunk/Source/WebCore/editing/Editor.h (141478 => 141479)


--- trunk/Source/WebCore/editing/Editor.h	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebCore/editing/Editor.h	2013-01-31 21:50:17 UTC (rev 141479)
@@ -296,6 +296,7 @@
     void confirmComposition();
     void confirmComposition(const String&); // if no existing composition, replaces selection
     void cancelComposition();
+    bool cancelCompositionIfSelectionIsInvalid();
     PassRefPtr<Range> compositionRange() const;
     bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const;
     bool setSelectionOffsets(int selectionStart, int selectionEnd);

Modified: trunk/Source/WebKit/chromium/ChangeLog (141478 => 141479)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,17 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::didCancelCompositionOnSelectionChange):
+            Adding a callback to let the WebViewClient know that the composition has been cancelled.
+        * src/EditorClientImpl.cpp:
+        (WebKit::EditorClientImpl::respondToChangedSelection):
+            Adding a call composition if it is no longer valid.
+
 2013-01-31  Mark Pilgrim  <[email protected]>
 
         [Chromium] Move LocalizedStrings to WebCore

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (141478 => 141479)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2013-01-31 21:50:17 UTC (rev 141479)
@@ -190,6 +190,7 @@
     virtual bool isSelectTrailingWhitespaceEnabled() { return true; }
 
     virtual void didBeginEditing() { }
+    virtual void didCancelCompositionOnSelectionChange() { }
     virtual void didChangeSelection(bool isSelectionEmpty) { }
     virtual void didChangeContents() { }
     virtual void didExecuteCommand(const WebString& commandName) { }

Modified: trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp (141478 => 141479)


--- trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp	2013-01-31 21:50:17 UTC (rev 141479)
@@ -268,8 +268,11 @@
 void EditorClientImpl::respondToChangedSelection(Frame* frame)
 {
     if (m_webView->client()) {
-        if (frame)
+        if (frame) {
             m_webView->client()->didChangeSelection(!frame->selection()->isRange());
+            if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
+                m_webView->client()->didCancelCompositionOnSelectionChange();
+        }
     }
 }
 

Modified: trunk/Source/WebKit/efl/ChangeLog (141478 => 141479)


--- trunk/Source/WebKit/efl/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/efl/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,14 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebCoreSupport/EditorClientEfl.cpp:
+        (WebCore::EditorClientEfl::respondToChangedSelection):
+            Adding a call to the newly refactored method.
+
 2013-01-31  Enrica Casucci  <[email protected]>
 
         WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp (141478 => 141479)


--- trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp	2013-01-31 21:50:17 UTC (rev 141479)
@@ -152,14 +152,7 @@
     Evas_Object* webFrame = EWKPrivate::kitFrame(coreFrame);
     ewk_frame_editor_client_selection_changed(webFrame);
 
-    if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
-        return;
-
-    unsigned start;
-    unsigned end;
-
-    if (!coreFrame->editor()->getCompositionSelection(start, end))
-        coreFrame->editor()->cancelComposition();
+    coreFrame->editor()->cancelCompositionIfSelectionIsInvalid();
 }
 
 void EditorClientEfl::didEndEditing()

Modified: trunk/Source/WebKit/gtk/ChangeLog (141478 => 141479)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,14 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::EditorClient::respondToChangedSelection):
+            Adding a call to the newly refactored Editor method.
+
 2013-01-31  Enrica Casucci  <[email protected]>
 
         WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp (141478 => 141479)


--- trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp	2013-01-31 21:50:17 UTC (rev 141479)
@@ -262,12 +262,7 @@
     setSelectionPrimaryClipboardIfNeeded(m_webView);
 #endif
 
-    if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange())
-        return;
-
-    unsigned start;
-    unsigned end;
-    if (!frame->editor()->getCompositionSelection(start, end))
+    if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
         m_webView->priv->imFilter.resetContext();
 }
 

Modified: trunk/Source/WebKit/mac/ChangeLog (141478 => 141479)


--- trunk/Source/WebKit/mac/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,13 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateSelectionForInputManager]):
+
 2013-01-31  Joseph Pecoraro  <[email protected]>
 
         Disable ENABLE_FULLSCREEN_API on iOS

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (141478 => 141479)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2013-01-31 21:50:17 UTC (rev 141479)
@@ -6037,12 +6037,9 @@
 
     [self _updateSecureInputState];
 
-    if (!coreFrame->editor()->hasComposition())
+    if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
         return;
 
-    if (coreFrame->editor()->ignoreCompositionSelectionChange())
-        return;
-
     unsigned start;
     unsigned end;
     if (coreFrame->editor()->getCompositionSelection(start, end))

Modified: trunk/Source/WebKit/win/ChangeLog (141478 => 141479)


--- trunk/Source/WebKit/win/ChangeLog	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/win/ChangeLog	2013-01-31 21:50:17 UTC (rev 141479)
@@ -1,3 +1,14 @@
+2013-01-31  Aurimas Liutikas  <[email protected]>
+
+        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
+        https://bugs.webkit.org/show_bug.cgi?id=107737
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView.cpp:
+        (WebView::updateSelectionForIME):
+            Adding a call to the newly refactored method.
+
 2013-01-31  Enrica Casucci  <[email protected]>
 
         WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.

Modified: trunk/Source/WebKit/win/WebView.cpp (141478 => 141479)


--- trunk/Source/WebKit/win/WebView.cpp	2013-01-31 21:47:25 UTC (rev 141478)
+++ trunk/Source/WebKit/win/WebView.cpp	2013-01-31 21:50:17 UTC (rev 141479)
@@ -5481,15 +5481,11 @@
 void WebView::updateSelectionForIME()
 {
     Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
-    if (!targetFrame || !targetFrame->editor()->hasComposition())
-        return;
     
-    if (targetFrame->editor()->ignoreCompositionSelectionChange())
+    if (!targetFrame)
         return;
 
-    unsigned start;
-    unsigned end;
-    if (!targetFrame->editor()->getCompositionSelection(start, end))
+    if (!targetFrame->editor()->cancelCompositionIfSelectionIsInvalid())
         resetIME(targetFrame);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to