当前位置: 首页>>代码示例>>C++>>正文


C++ Frame::selection方法代码示例

本文整理汇总了C++中webcore::Frame::selection方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::selection方法的具体用法?C++ Frame::selection怎么用?C++ Frame::selection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webcore::Frame的用法示例。


在下文中一共展示了Frame::selection方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: selectedRange

bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
{
    if (!(start && length))
        return false;

    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

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

    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
    RefPtr<WebCore::Range> range = frame->selection()->toNormalizedRange().get();
    if (!range)
        return false;

    WebCore::Element* selectionRoot = frame->selection()->rootEditableElement();
    WebCore::Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();

    RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
    *start = WebCore::TextIterator::rangeLength(testRange.get());

    WebCore::ExceptionCode ec;
    testRange->setEnd(range->endContainer(), range->endOffset(), ec);
    *length = WebCore::TextIterator::rangeLength(testRange.get());

    return true;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: fromDocumentRange

// static
WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length)
{
    WebCore::Frame* webFrame = static_cast<WebFrameImpl*>(frame)->frame();
    Element* selectionRoot = webFrame->selection()->rootEditableElement();
    Element* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement();
    return TextIterator::rangeFromLocationAndLength(scope, start, length);
}
开发者ID:Moondee,项目名称:Artemis,代码行数:8,代码来源:WebRange.cpp

示例3: selectionRectangle

WebCore::IntRect DumpRenderTreeSupportEfl::selectionRectangle(const Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return WebCore::IntRect();

    return enclosingIntRect(frame->selection()->bounds());
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: OnKillFocus

void wxWebView::OnKillFocus(wxFocusEvent& event)
{
    WebCore::Frame* frame = 0;
    if (m_mainFrame)
        frame = m_mainFrame->GetFrame();
        
    if (frame) {
        frame->selection()->setFocused(false);
    }
    event.Skip();
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:11,代码来源:WebView.cpp

示例5: OnKillFocus

void wxWebView::OnKillFocus(wxFocusEvent& event)
{
    WebCore::Frame* frame = 0;
    if (m_mainFrame)
        frame = m_mainFrame->GetFrame();
        
    if (frame) {
        m_impl->page->focusController()->setActive(false);
        frame->selection()->setFocused(false);
    }
    event.Skip();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:12,代码来源:WebView.cpp

示例6: selectedRange

QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter)
{
    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
    QVariantList selectedRange;
    RefPtr<Range> range = frame->selection()->toNormalizedRange().get();

    Element* selectionRoot = frame->selection()->rootEditableElement();
    Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();

    RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
    ASSERT(testRange->startContainer() == scope);
    int startPosition = TextIterator::rangeLength(testRange.get());

    ExceptionCode ec;
    testRange->setEnd(range->endContainer(), range->endOffset(), ec);
    ASSERT(testRange->startContainer() == scope);
    int endPosition = TextIterator::rangeLength(testRange.get());

    selectedRange << startPosition << (endPosition - startPosition);

    return selectedRange;

}
开发者ID:jbat100,项目名称:webkit,代码行数:23,代码来源:DumpRenderTreeSupportQt.cpp

示例7: firstRectForCharacterRange

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;
}
开发者ID:jbat100,项目名称:webkit,代码行数:17,代码来源:DumpRenderTreeSupportQt.cpp

示例8: firstRectForCharacterRange

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());
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:18,代码来源:DumpRenderTreeSupportEfl.cpp

示例9: firstRectForCharacterRange

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());
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10: webkit_web_view_key_press_event

static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
{
//    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);

    WebCore::Frame* frame = core(webView_s)->focusController()->focusedOrMainFrame();
    PlatformKeyboardEvent keyboardEvent(event);

    if (frame->eventHandler()->keyEvent(keyboardEvent))
        return TRUE;

    FrameView* view = frame->view();
    SelectionController::EAlteration alteration;
    if (event->state & GDK_SHIFT_MASK)
        alteration = SelectionController::EXTEND;
    else
        alteration = SelectionController::MOVE;

    // TODO: We probably want to use GTK+ key bindings here and perhaps take an
    // approach more like the Win and Mac ports for key handling.
    switch (event->keyval) {
    case GDK_Down:
        view->scrollBy(IntSize(0, (int)Scrollbar::pixelsPerLineStep()));
        return TRUE;
    case GDK_Up:
        view->scrollBy(IntSize(0, (int)-Scrollbar::pixelsPerLineStep()));
        return TRUE;
    case GDK_Right:
        view->scrollBy(IntSize((int)Scrollbar::pixelsPerLineStep(), 0));
        return TRUE;
    case GDK_Left:
        view->scrollBy(IntSize((int)-Scrollbar::pixelsPerLineStep(), 0));
        return TRUE;
    case GDK_Home:
        frame->selection()->modify(alteration, SelectionController::BACKWARD, DocumentBoundary, true);
        return TRUE;
    case GDK_End:
        frame->selection()->modify(alteration, SelectionController::FORWARD, DocumentBoundary, true);
        return TRUE;
    case GDK_Escape:
        gtk_main_quit();
        return true;
    case GDK_F1:
        webView_s->goBack();
        return true;
    case GDK_F2:
        webView_s->goForward();
        return true;
    case GDK_F3:
        // We ignore the return value as we are not interested
        // in whether the zoom occurred.
        webView_s->zoomPageIn();
        return true;
    case GDK_F4:
        // Same comment as above.
        webView_s->zoomPageOut();
        return true;
    }

    /* Chain up to our parent class for binding activation */
    return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:61,代码来源:browserWidget.cpp


注:本文中的webcore::Frame::selection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。