Changeset 141545 in webkit


Ignore:
Timestamp:
Jan 31, 2013 11:43:13 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Aurimas Liutikas <aurimas@chromium.org> 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:

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141542 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * 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
     9
    1102013-01-31  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
    211
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r141529 r141545  
    11011101crbug.com/64938 editing/selection/5354455-1.html [ Failure ]
    11021102
    1103 webkit.org/b/55560 editing/input/setting-input-value-cancel-ime-composition.html [ Failure ]
    1104 
    11051103# New test added in r82159
    11061104crbug.com/77706 editing/spelling/grammar.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r141543 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Chromium has a bug where the IME composition did not get cancelled on JavaScript changes
     9        to the focused editing field. Most of other WebKit ports were already doing this check
     10        in their EditorClient::respondToChangedSelection. I took that logic and moved it to the
     11        Editor so every port and use the same code.
     12
     13        An existing test editing/input/setting-input-value-cancel-ime-composition.html covers this change.
     14        This test used to have an expectation to fail on Chromium and after this patch it will start passing.
     15
     16        * editing/Editor.cpp:
     17        (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
     18            Adding a call that can be used by any the port to cancel the composition if it's no longer valid.
     19        (WebCore):
     20        * editing/Editor.h:
     21        (Editor):
     22
    1232013-01-31  Jae Hyun Park  <jae.park@company100.net>
    224
  • trunk/Source/WebCore/editing/Editor.cpp

    r141525 r141545  
    13441344}
    13451345
     1346bool Editor::cancelCompositionIfSelectionIsInvalid()
     1347{
     1348    unsigned start;
     1349    unsigned end;
     1350    if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
     1351        return false;
     1352
     1353    cancelComposition();
     1354    return true;
     1355}
     1356
    13461357void Editor::confirmComposition(const String& text)
    13471358{
  • trunk/Source/WebCore/editing/Editor.h

    r141525 r141545  
    297297    void confirmComposition(const String&); // if no existing composition, replaces selection
    298298    void cancelComposition();
     299    bool cancelCompositionIfSelectionIsInvalid();
    299300    PassRefPtr<Range> compositionRange() const;
    300301    bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const;
  • trunk/Source/WebKit/chromium/ChangeLog

    r141540 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * public/WebViewClient.h:
     9        (WebKit::WebViewClient::didCancelCompositionOnSelectionChange):
     10            Adding a callback to let the WebViewClient know that the composition has been cancelled.
     11        * src/EditorClientImpl.cpp:
     12        (WebKit::EditorClientImpl::respondToChangedSelection):
     13            Adding a call composition if it is no longer valid.
     14
    1152013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
    216
  • trunk/Source/WebKit/chromium/public/WebViewClient.h

    r141525 r141545  
    191191
    192192    virtual void didBeginEditing() { }
     193    virtual void didCancelCompositionOnSelectionChange() { }
    193194    virtual void didChangeSelection(bool isSelectionEmpty) { }
    194195    virtual void didChangeContents() { }
  • trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp

    r141525 r141545  
    269269{
    270270    if (m_webView->client()) {
    271         if (frame)
     271        if (frame) {
    272272            m_webView->client()->didChangeSelection(!frame->selection()->isRange());
     273            if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
     274                m_webView->client()->didCancelCompositionOnSelectionChange();
     275        }
    273276    }
    274277}
  • trunk/Source/WebKit/efl/ChangeLog

    r141525 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * WebCoreSupport/EditorClientEfl.cpp:
     9        (WebCore::EditorClientEfl::respondToChangedSelection):
     10            Adding a call to the newly refactored method.
     11
    1122013-01-31  Sheriff Bot  <webkit.review.bot@gmail.com>
    213
  • trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp

    r141525 r141545  
    153153    ewk_frame_editor_client_selection_changed(webFrame);
    154154
    155     if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
    156         return;
    157 
    158     unsigned start;
    159     unsigned end;
    160 
    161     if (!coreFrame->editor()->getCompositionSelection(start, end))
    162         coreFrame->editor()->cancelComposition();
     155    coreFrame->editor()->cancelCompositionIfSelectionIsInvalid();
    163156}
    164157
  • trunk/Source/WebKit/gtk/ChangeLog

    r141525 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * WebCoreSupport/EditorClientGtk.cpp:
     9        (WebKit::EditorClient::respondToChangedSelection):
     10            Adding a call to the newly refactored Editor method.
     11
    1122013-01-31  Sheriff Bot  <webkit.review.bot@gmail.com>
    213
  • trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

    r141525 r141545  
    263263#endif
    264264
    265     if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange())
    266         return;
    267 
    268     unsigned start;
    269     unsigned end;
    270     if (!frame->editor()->getCompositionSelection(start, end))
     265    if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
    271266        m_webView->priv->imFilter.resetContext();
    272267}
  • trunk/Source/WebKit/mac/ChangeLog

    r141525 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * WebView/WebHTMLView.mm:
     9        (-[WebHTMLView _updateSelectionForInputManager]):
     10
    1112013-01-31  Sheriff Bot  <webkit.review.bot@gmail.com>
    212
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r141525 r141545  
    60386038    [self _updateSecureInputState];
    60396039
    6040     if (!coreFrame->editor()->hasComposition())
    6041         return;
    6042 
    6043     if (coreFrame->editor()->ignoreCompositionSelectionChange())
     6040    if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
    60446041        return;
    60456042
  • trunk/Source/WebKit/win/ChangeLog

    r141525 r141545  
     12013-01-31  Aurimas Liutikas  <aurimas@chromium.org>
     2
     3        Editor::m_compositionNode not updated on HTMLInputElement::setValue()
     4        https://bugs.webkit.org/show_bug.cgi?id=107737
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * WebView.cpp:
     9        (WebView::updateSelectionForIME):
     10            Adding a call to the newly refactored method.
     11
    1122013-01-31  Sheriff Bot  <webkit.review.bot@gmail.com>
    213
  • trunk/Source/WebKit/win/WebView.cpp

    r141525 r141545  
    54825482{
    54835483    Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
    5484     if (!targetFrame || !targetFrame->editor()->hasComposition())
     5484   
     5485    if (!targetFrame)
    54855486        return;
    5486    
    5487     if (targetFrame->editor()->ignoreCompositionSelectionChange())
    5488         return;
    5489 
    5490     unsigned start;
    5491     unsigned end;
    5492     if (!targetFrame->editor()->getCompositionSelection(start, end))
     5487
     5488    if (!targetFrame->editor()->cancelCompositionIfSelectionIsInvalid())
    54935489        resetIME(targetFrame);
    54945490}
Note: See TracChangeset for help on using the changeset viewer.