本文整理汇总了C++中RenderObject::absoluteFocusRingQuads方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::absoluteFocusRingQuads方法的具体用法?C++ RenderObject::absoluteFocusRingQuads怎么用?C++ RenderObject::absoluteFocusRingQuads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::absoluteFocusRingQuads方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTapHighlight
void TouchEventHandler::drawTapHighlight()
{
Element* elementUnderFatFinger = m_lastFatFingersResult.nodeAsElementIfApplicable();
if (!elementUnderFatFinger)
return;
Element* element = elementForTapHighlight(elementUnderFatFinger);
if (!element)
return;
// Get the element bounding rect in transformed coordinates so we can extract
// the focus ring relative position each rect.
RenderObject* renderer = element->renderer();
ASSERT(renderer);
Frame* elementFrame = element->document()->frame();
ASSERT(elementFrame);
FrameView* elementFrameView = elementFrame->view();
if (!elementFrameView)
return;
// Tell the client if the element is either in a scrollable container or in a fixed positioned container.
// On the client side, this info is being used to hide the tap highlight window on scroll.
RenderLayer* layer = m_webPage->enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(renderer->enclosingLayer());
bool shouldHideTapHighlightRightAfterScrolling = !layer->renderer()->isRenderView();
shouldHideTapHighlightRightAfterScrolling |= !!m_webPage->m_inRegionScroller->d->node();
IntPoint framePos(m_webPage->frameOffset(elementFrame));
// FIXME: We can get more precise on the <map> case by calculating the rect with HTMLAreaElement::computeRect().
IntRect absoluteRect(renderer->absoluteClippedOverflowRect());
absoluteRect.move(framePos.x(), framePos.y());
IntRect clippingRect;
if (elementFrame == m_webPage->mainFrame())
clippingRect = IntRect(IntPoint(0, 0), elementFrameView->contentsSize());
else
clippingRect = m_webPage->mainFrame()->view()->windowToContents(m_webPage->getRecursiveVisibleWindowRect(elementFrameView, true /*noClipToMainFrame*/));
clippingRect = intersection(absoluteRect, clippingRect);
Vector<FloatQuad> focusRingQuads;
renderer->absoluteFocusRingQuads(focusRingQuads);
Platform::IntRectRegion region;
for (size_t i = 0; i < focusRingQuads.size(); ++i) {
IntRect rect = focusRingQuads[i].enclosingBoundingBox();
rect.move(framePos.x(), framePos.y());
IntRect clippedRect = intersection(clippingRect, rect);
clippedRect.inflate(2);
region = unionRegions(region, Platform::IntRect(clippedRect));
}
Color highlightColor = element->renderStyle()->tapHighlightColor();
m_webPage->m_tapHighlight->draw(region,
highlightColor.red(), highlightColor.green(), highlightColor.blue(), highlightColor.alpha(),
shouldHideTapHighlightRightAfterScrolling);
}
示例2: buildHighlightRects
void AndroidHitTestResult::buildHighlightRects()
{
m_highlightRects.clear();
Node* node = m_hitTestResult.URLElement();
if (!node || !node->renderer())
node = m_hitTestResult.innerNode();
if (!node || !node->renderer())
return;
if (!WebViewCore::nodeIsClickableOrFocusable(node))
return;
Frame* frame = node->document()->frame();
IntPoint frameOffset = m_webViewCore->convertGlobalContentToFrameContent(IntPoint(), frame);
RenderObject* renderer = node->renderer();
Vector<FloatQuad> quads;
if (renderer->isInline())
renderer->absoluteFocusRingQuads(quads);
if (!quads.size())
renderer->absoluteQuads(quads); // No fancy rings, grab a bounding box
for (size_t i = 0; i < quads.size(); i++) {
IntRect boundingBox = quads[i].enclosingBoundingBox();
boundingBox.move(-frameOffset.x(), -frameOffset.y());
m_highlightRects.append(boundingBox);
}
}