本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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;
}