[webkit-help] Key event handling suspect code

S Boucher stbya at yahoo.com
Wed Jun 8 12:10:54 PDT 2011


I'm trying to understand the keyboard handling, and I spotted
something puzzling.  In EventHandler::keyEvent(const
PlatformKeyboardEvent&), I see:

    m_frame->editor()->handleInputMethodKeydown(keydown.get());

    bool handledByInputMethod = keydown->defaultHandled();

    if (handledByInputMethod) {
        keyDownEvent.setWindowsVirtualKeyCode(CompositionEventKeyCode);
        keydown = KeyboardEvent::create(keyDownEvent, m_frame->document()->defaultView());
        keydown->setTarget(node);
        keydown->setDefaultHandled();
    }

I presume that the intent is that in some cases,
EditorClient::handleInputMethodKeydown() will eventually call
keydown->setDefaultHandled()?

However, all platforms, except gtk, have an empty
handleInputMethodKeydown(), and for Gtk, the method never calls
->setDefaultHandled().  In other words, it seems like
handledByInputMethod is always false?!  ... unless I'm missing something.

Another thing related to Gtk:  In EditorClient::handleInputMethodKeydown(), towards the end, we see:

    clearPendingComposition();
    if ((gtk_im_context_filter_keypress(priv->imContext.get(), event->keyEvent()->gdkEventKey()) && !m_pendingComposition)

So, why even have !m_pendingComposition in the if case given the
clearPendingComposition()?        


More information about the webkit-help mailing list