Ejemplo n.º 1
0
void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length)
{
    WebCore::Page* page = EWKPrivate::corePage(ewkView);
    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
        return;

    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
    if (!editor || (!editor->canEdit() && !editor->hasComposition()))
        return;

    const String compositionString = String::fromUTF8(text);
    Vector<WebCore::CompositionUnderline> underlines;
    underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false));
    editor->setComposition(compositionString, underlines, start, start + length);
}
Ejemplo n.º 2
0
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
{
    *start = *length = 0;

    WebCore::Page* page = EWKPrivate::corePage(ewkView);
    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
        return false;

    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
    if (!editor || !editor->hasComposition())
        return false;

    *start = editor->compositionStart();
    *length = editor->compositionEnd() - *start;
    return true;
}
Ejemplo n.º 3
0
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
{
    *start = *length = 0;

    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
        return false;

    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
    if (!editor || !editor->hasComposition())
        return false;

    *start = editor->compositionStart();
    *length = editor->compositionEnd() - *start;
    return true;
}
Ejemplo n.º 4
0
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
{
    WebCore::Page* page = EWKPrivate::corePage(ewkView);
    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
        return;

    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
    if (!editor)
        return;

    if (!editor->hasComposition()) {
        editor->insertText(String::fromUTF8(text), 0);
        return;
    }

    if (text) {
        editor->confirmComposition(String::fromUTF8(text));
        return;
    }
    editor->confirmComposition();
}
Ejemplo n.º 5
0
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
        return;

    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
    if (!editor)
        return;

    if (!editor->hasComposition()) {
        editor->insertText(String::fromUTF8(text), 0);
        return;
    }

    if (text) {
        editor->confirmComposition(String::fromUTF8(text));
        return;
    }
    editor->confirmComposition();
}