Exemplo n.º 1
0
bool DumpRenderTreeSupportQt::findString(QWebPageAdapter *adapter, const QString& string, const QStringList& optionArray)
{
    // 1. Parse the options from the array
    WebCore::FindOptions options = 0;
    const int optionCount = optionArray.size();
    for (int i = 0; i < optionCount; ++i) {
        const QString& option = optionArray.at(i);
        if (option == QLatin1String("CaseInsensitive"))
            options |= WebCore::CaseInsensitive;
        else if (option == QLatin1String("AtWordStarts"))
            options |= WebCore::AtWordStarts;
        else if (option == QLatin1String("TreatMedialCapitalAsWordStart"))
            options |= WebCore::TreatMedialCapitalAsWordStart;
        else if (option == QLatin1String("Backwards"))
            options |= WebCore::Backwards;
        else if (option == QLatin1String("WrapAround"))
            options |= WebCore::WrapAround;
        else if (option == QLatin1String("StartInSelection"))
            options |= WebCore::StartInSelection;
    }

    // 2. find the string
    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
    return frame && frame->editor()->findString(string, options);
}
Exemplo n.º 2
0
void BWebPage::handleSendEditingCapabilities(BMessage*)
{
    bool canCut = false;
    bool canCopy = false;
    bool canPaste = false;

    WebCore::Frame* frame = fPage->focusController()->focusedOrMainFrame();
    if (frame && frame->editor()) {
        WebCore::Editor* editor = frame->editor();

        canCut = editor->canCut() || editor->canDHTMLCut();
        canCopy = editor->canCopy() || editor->canDHTMLCopy();
        canPaste = editor->canPaste() || editor->canDHTMLPaste();
    }

    BMessage message(B_EDITING_CAPABILITIES_RESULT);
    message.AddBool("can cut", canCut);
    message.AddBool("can copy", canCopy);
    message.AddBool("can paste", canPaste);

    dispatchMessage(message);
}
Exemplo n.º 3
0
QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length)
{
    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
    QVariantList rect;

    if ((location + length < location) && (location + length))
        length = 0;

    RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);

    if (!range)
        return QVariantList();

    QRect resultRect = frame->editor()->firstRectForRange(range.get());
    rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
    return rect;
}
Exemplo n.º 4
0
static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
{
    //WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
    ////WebKitWebViewPrivate* priv = webView->priv;
    WebCore::Frame* focusedFrame = core(webView_s)->focusController()->focusedFrame();

    if (focusedFrame && focusedFrame->editor()->canEdit()) {
        GdkWindow* window = gtk_widget_get_parent_window(widget);
        gtk_im_context_set_client_window(imContext, window);
#ifdef MAEMO_CHANGES
        hildon_gtk_im_context_filter_event(imContext, (GdkEvent*)event);
        hildon_gtk_im_context_show(imContext);
#endif
    }

    return focusedFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
}
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect());

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

    if ((location + length < location) && (location + length))
        length = 0;

    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();

    RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
    if (!range)
        return WebCore::IntRect();

    return frame->editor().firstRectForRange(range.get());
}
Exemplo n.º 6
0
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
    WebCore::Page* page = EWKPrivate::corePage(ewkView);
    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
        return WebCore::IntRect();

    if ((location + length < location) && (location + length))
        length = 0;

    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
    WebCore::Editor* editor = frame->editor();

    RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
    if (!range)
        return WebCore::IntRect();

    return editor->firstRectForRange(range.get());
}
Exemplo n.º 7
0
static void webkit_web_view_real_paste_clipboard(WebKitWebView*)
{
    WebCore::Frame* frame = core(webView_s)->focusController()->focusedOrMainFrame();
    frame->editor()->command("Paste").execute();
}
Exemplo n.º 8
0
static void webkit_web_view_real_select_all(WebKitWebView*)
{
    WebCore::Frame* frame = core(webView_s)->focusController()->focusedOrMainFrame();
    frame->editor()->command("SelectAll").execute();
}