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


C++ Element::document方法代码示例

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


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

示例1: render

/*! 
  Render the element into \a painter .
*/
void QWebElement::render(QPainter* painter)
{
    WebCore::Element* e = m_element;
    Document* doc = e ? e->document() : 0;
    if (!doc)
        return;

    Frame* frame = doc->frame();
    if (!frame || !frame->view() || !frame->contentRenderer())
        return;

    FrameView* view = frame->view();

    view->layoutIfNeededRecursive();

    IntRect rect = e->getRect();

    if (rect.size().isEmpty())
        return;

    GraphicsContext context(painter);

    context.save();
    context.translate(-rect.x(), -rect.y());
    view->setNodeToDraw(e);
    view->paintContents(&context, rect);
    view->setNodeToDraw(0);
    context.restore();
}
开发者ID:dzip,项目名称:webkit,代码行数:32,代码来源:qwebelement.cpp

示例2: 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,代码来源:

示例3: getCoreDocumentFromVariantMap

WebCore::Document* DumpRenderTreeSupportQt::getCoreDocumentFromVariantMap(const QVariantMap& document)
{
    QVariant v = document.value(QLatin1String("documentElement"));
    ASSERT(v.isValid());
    QWebElement documentElement = qvariant_cast<QWebElement>(v);

    WebCore::Element* element = documentElement.m_element;
    if (!element)
        return 0;

    return element->document();
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: nodesFromRect

QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
{
    QVariantList res;
    WebCore::Element* webElement = document.m_element;
    if (!webElement)
        return res;

    Document* doc = webElement->document();
    if (!doc)
        return res;
    RefPtr<NodeList> nodes = doc->nodesFromRect(x, y, top, right, bottom, left, ignoreClipping);
    for (int i = 0; i < nodes->length(); i++) {
        QVariant v;
        // QWebElement will be null if the Node is not an HTML Element
        v.setValue(QWebElement(nodes->item(i)));
        res << v;
    }
    return res;
}
开发者ID:,项目名称:,代码行数:19,代码来源:


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