Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-71995

Virtual keyboard's text prediction doesn't work with WebEngine

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12
    • Virtual Keyboard, WebEngine
    • None
    • All

    Description

      WebEngine performs Input Method Events asynchronously:

      1. WebEngine accepts the event
      2. WebEngine converts it for Chromium
      3. WebEngine sends it to Chromium's renderer process
      4. WebEngine's event handler returns
      5. The Chromium's renderer process notifies WebEngine about the input method is performed
      6. WebEngine calls QInputMethod::update() to notify the embedder application (or virtual keyboard) about the change ( https://codereview.qt-project.org/#/c/246203/ )

      Virtual keyboard doesn't seem to be prepared for the asynchronous handling of these events (src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp):

      void QVirtualKeyboardInputContextPrivate::sendInputMethodEvent(QInputMethodEvent *event)
      {
          QVirtualKeyboardScopedState inputMethodEventState(this, State::InputMethodEvent);
          platformInputContext->sendEvent(event);
      }
      

      When PlatformInputContext::sendEvent() returns, WebEngine has not performed the event yet but VirtualKeyboard clears its InputMethodEvent state.
      Due to this, VirtualKeyboard will consider the result of its own event as another one and tries to trigger a yet another one by QVirtualKeyboardInputEngine::reselect().

      This causes assert like this: https://bugreports.qt.io/browse/QTBUG-70158 or glitches (eg. commit an earlier text prediction) when changing cursor position or switching
      input field.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-71995
          # Subject Branch Project Status CR V

          Activity

            People

              jakoivik Jarkko Koivikko
              pvarga Peter Varga
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are 2 open Gerrit changes