Changeset 166421 in webkit


Ignore:
Timestamp:
Mar 28, 2014 12:11:18 PM (10 years ago)
Author:
ap@apple.com
Message:

Eliminate a sync cancelComposition call in WebPageProxy::editorStateChanged
https://bugs.webkit.org/show_bug.cgi?id=130727

Reviewed by Enrica Casucci.

Added a separate CompositionWasCanceled IPC call, with which WebProcess can tell
UIProcess that it should notify an input method of canceled composition. There are
a lot of incorrect edge cases where we don't call it correctly, but this was true
in the old implementation too (for different edge cases).

This change only affects iOS and async NSTextInputClient code path on Mac. I don't
want to change sync NSTextInputClient code path unless absolutely necessary.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::compositionWasCanceled):
(WebKit::WebPageProxy::resetStateAfterProcessExited):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::executeKeypressCommands):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::didChangeSelection):

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r166410 r166421  
     12014-03-28  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Eliminate a sync cancelComposition call in WebPageProxy::editorStateChanged
     4        https://bugs.webkit.org/show_bug.cgi?id=130727
     5
     6        Reviewed by Enrica Casucci.
     7
     8        Added a separate CompositionWasCanceled IPC call, with which WebProcess can tell
     9        UIProcess that it should notify an input method of canceled composition. There are
     10        a lot of incorrect edge cases where we don't call it correctly, but this was true
     11        in the old implementation too (for different edge cases).
     12
     13        This change only affects iOS and async NSTextInputClient code path on Mac. I don't
     14        want to change sync NSTextInputClient code path unless absolutely necessary.
     15
     16        * UIProcess/WebPageProxy.cpp:
     17        (WebKit::WebPageProxy::WebPageProxy):
     18        (WebKit::WebPageProxy::editorStateChanged):
     19        (WebKit::WebPageProxy::compositionWasCanceled):
     20        (WebKit::WebPageProxy::resetStateAfterProcessExited):
     21        * UIProcess/WebPageProxy.h:
     22        * UIProcess/WebPageProxy.messages.in:
     23        * UIProcess/mac/WebPageProxyMac.mm:
     24        (WebKit::WebPageProxy::insertText):
     25        (WebKit::WebPageProxy::executeKeypressCommands):
     26        * WebProcess/WebPage/WebPage.cpp:
     27        (WebKit::WebPage::didChangeSelection):
     28
    1292014-03-28  Mario Sanchez Prada  <mario.prada@samsung.com>
    230
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r166374 r166421  
    269269    , m_backForwardList(WebBackForwardList::create(*this))
    270270    , m_loadStateAtProcessExit(FrameLoadState::State::Finished)
     271#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    271272    , m_temporarilyClosedComposition(false)
     273#endif
    272274    , m_textZoomFactor(1)
    273275    , m_pageZoomFactor(1)
     
    31213123#if PLATFORM(COCOA)
    31223124    bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
     3125#endif
     3126#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    31233127    bool closedComposition = !editorState.shouldIgnoreCompositionSelectionChange && !editorState.hasComposition && (m_editorState.hasComposition || m_temporarilyClosedComposition);
    31243128    m_temporarilyClosedComposition = editorState.shouldIgnoreCompositionSelectionChange && (m_temporarilyClosedComposition || m_editorState.hasComposition) && !editorState.hasComposition;
     
    31313135    if (couldChangeSecureInputState && !editorState.selectionIsNone)
    31323136        m_pageClient.updateSecureInputState();
     3137#endif
    31333138
    31343139    if (editorState.shouldIgnoreCompositionSelectionChange)
    31353140        return;
    31363141
     3142#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    31373143    if (closedComposition)
    31383144        m_pageClient.notifyInputContextAboutDiscardedComposition();
     
    31433149        m_pageClient.notifyInputContextAboutDiscardedComposition();
    31443150    }
    3145 #if PLATFORM(IOS)
    3146     else {
     3151#elif PLATFORM(IOS)
     3152    if (!editorState.hasComposition) {
    31473153        // We need to notify the client on iOS to make sure the selection is redrawn.
    31483154        notifyRevealedSelection();
    31493155    }
    3150 #endif
    31513156#elif PLATFORM(EFL) || PLATFORM(GTK)
    31523157    m_pageClient.updateTextInputState();
    31533158#endif
     3159}
     3160
     3161void WebPageProxy::compositionWasCanceled(const EditorState& editorState)
     3162{
     3163#if PLATFORM(COCOA)
     3164    m_pageClient.notifyInputContextAboutDiscardedComposition();
     3165#endif
     3166    editorStateChanged(editorState);
    31543167}
    31553168
     
    40744087    // FIXME: Reset m_editorState.
    40754088    // FIXME: Notify input methods about abandoned composition.
     4089#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    40764090    m_temporarilyClosedComposition = false;
     4091#endif
    40774092
    40784093#if PLATFORM(MAC)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r166384 r166421  
    11871187
    11881188    void editorStateChanged(const EditorState&);
     1189    void compositionWasCanceled(const EditorState&);
    11891190
    11901191    // Back/Forward list management
     
    14711472
    14721473    EditorState m_editorState;
     1474#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    14731475    bool m_temporarilyClosedComposition; // Editor state changed from hasComposition to !hasComposition, but that was only with shouldIgnoreCompositionSelectionChange yet.
     1476#endif
    14741477
    14751478    double m_textZoomFactor;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r166384 r166421  
    204204    # Editor notifications
    205205    EditorStateChanged(WebKit::EditorState editorState)
     206    CompositionWasCanceled(WebKit::EditorState editorState)
    206207
    207208    # Find messages
  • trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r166105 r166421  
    181181    bool handled = true;
    182182    process().sendSync(Messages::WebPage::InsertText(text, replacementRange), Messages::WebPage::InsertText::Reply(handled, m_editorState), m_pageID);
     183#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    183184    m_temporarilyClosedComposition = false;
     185#endif
    184186
    185187    return handled;
     
    271273    bool result = false;
    272274    process().sendSync(Messages::WebPage::ExecuteKeypressCommands(commands), Messages::WebPage::ExecuteKeypressCommands::Reply(result, m_editorState), m_pageID);
     275#if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
    273276    m_temporarilyClosedComposition = false;
     277#endif
    274278    return result;
    275279}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r166384 r166421  
    41104110void WebPage::didChangeSelection()
    41114111{
    4112     send(Messages::WebPageProxy::EditorStateChanged(editorState()));
     4112#if (PLATFORM(MAC) && USE(ASYNC_NSTEXTINPUTCLIENT)) || PLATFORM(IOS)
     4113    Frame& frame = m_page->focusController().focusedOrMainFrame();
     4114    // Abandon the current inline input session if selection changed for any other reason but an input method direct action.
     4115    // FIXME: Many changes that affect composition node do not go through didChangeSelection(). We need to do something when DOM manipulation affects the composition, because otherwise input method's idea about it will be different from Editor's.
     4116    // FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
     4117    if (frame.editor().hasComposition() && !frame.editor().ignoreCompositionSelectionChange() && !frame.selection().isNone()) {
     4118        frame.editor().cancelComposition();
     4119        send(Messages::WebPageProxy::CompositionWasCanceled(editorState()));
     4120    } else
     4121#endif
     4122        send(Messages::WebPageProxy::EditorStateChanged(editorState()));
     4123
    41134124#if PLATFORM(IOS)
    41144125    m_drawingArea->scheduleCompositingLayerFlush();
Note: See TracChangeset for help on using the changeset viewer.