Example #1
0
void EditorClient::respondToChangedSelection()
{
    g_signal_emit_by_name(m_webView, "selection-changed");

    WebKitWebViewPrivate* priv = m_webView->priv;
    WebCore::Page* corePage = core(m_webView);
    Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();

    if (!targetFrame)
        return;

    if (targetFrame->editor()->ignoreCompositionSelectionChange())
        return;

#if PLATFORM(X11)
    setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif

    if (!targetFrame->editor()->hasComposition())
        return;

    unsigned start;
    unsigned end;
    if (!targetFrame->editor()->getCompositionSelection(start, end)) {
        // gtk_im_context_reset() clears the composition for us.
        gtk_im_context_reset(priv->imContext.get());
        targetFrame->editor()->cancelComposition();
    }
}
Example #2
0
void EditorClient::respondToChangedSelection(Frame* frame)
{
    g_signal_emit_by_name(m_webView, "selection-changed");

    if (!frame)
        return;

#if PLATFORM(X11)
    setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif

    if (frame->editor().cancelCompositionIfSelectionIsInvalid())
        m_webView->priv->imFilter.resetContext();
}
Example #3
0
void EditorClient::respondToChangedSelection(Frame* frame)
{
    g_signal_emit_by_name(m_webView, "selection-changed");

    if (!frame)
        return;

#if PLATFORM(X11)
    setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif

    if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange())
        return;

    unsigned start;
    unsigned end;
    if (!frame->editor()->getCompositionSelection(start, end))
        m_webView->priv->imFilter.resetContext();
}
Example #4
0
void WebEditorClient::respondToChangedSelection(Frame* frame)
{
    DEFINE_STATIC_LOCAL(String, WebViewDidChangeSelectionNotification, ("WebViewDidChangeSelectionNotification"));
    m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl());
    if (!frame)
        return;

    EditorState state = m_page->editorState();

    m_page->send(Messages::WebPageProxy::EditorStateChanged(state));

#if PLATFORM(WIN)
    // FIXME: This should also go into the selection state.
    if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange())
        return;

    unsigned start;
    unsigned end;
    m_page->send(Messages::WebPageProxy::DidChangeCompositionSelection(frame->editor()->getCompositionSelection(start, end)));
#elif PLATFORM(GTK)
    setSelectionPrimaryClipboardIfNeeded(frame);
#endif
}