本文整理汇总了C++中RenderObject::enclosingLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::enclosingLayer方法的具体用法?C++ RenderObject::enclosingLayer怎么用?C++ RenderObject::enclosingLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::enclosingLayer方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBackgroundBlurOnNode
void Internals::setBackgroundBlurOnNode(Node* node, int blurLength, ExceptionCode& ec)
{
if (!node) {
ec = INVALID_ACCESS_ERR;
return;
}
RenderObject* renderObject = node->renderer();
if (!renderObject) {
ec = INVALID_NODE_TYPE_ERR;
return;
}
RenderLayer* renderLayer = renderObject->enclosingLayer();
if (!renderLayer || !renderLayer->isComposited()) {
ec = INVALID_STATE_ERR;
return;
}
GraphicsLayer* graphicsLayer = renderLayer->backing()->graphicsLayer();
if (!graphicsLayer) {
ec = INVALID_NODE_TYPE_ERR;
return;
}
PlatformLayer* platformLayer = graphicsLayer->platformLayer();
if (!platformLayer) {
ec = INVALID_NODE_TYPE_ERR;
return;
}
FilterOperations filters;
filters.operations().append(BlurFilterOperation::create(Length(blurLength, Fixed), FilterOperation::BLUR));
platformLayer->setBackgroundFilters(filters);
}
示例2: computeEnclosingCompositingLayer
RenderLayer* LinkHighlight::computeEnclosingCompositingLayer()
{
if (!m_node || !m_node->renderer())
return 0;
// Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries
// to find a suitable layer.
RenderObject* renderer = m_node->renderer();
RenderLayer* renderLayer;
do {
renderLayer = renderer->enclosingLayer()->enclosingCompositingLayerForRepaint();
if (!renderLayer) {
renderer = renderer->frame()->ownerRenderer();
if (!renderer)
return 0;
}
} while (!renderLayer);
CompositedLayerMappingPtr compositedLayerMapping = renderLayer->compositingState() == PaintsIntoGroupedBacking ? renderLayer->groupedMapping() : renderLayer->compositedLayerMapping();
GraphicsLayer* newGraphicsLayer = renderLayer->compositingState() == PaintsIntoGroupedBacking ? compositedLayerMapping->squashingLayer() : compositedLayerMapping->mainGraphicsLayer();
m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor));
if (!newGraphicsLayer->drawsContent()) {
if (renderLayer->scrollableArea() && renderLayer->scrollableArea()->usesCompositedScrolling()) {
ASSERT(renderLayer->hasCompositedLayerMapping() && renderLayer->compositedLayerMapping()->scrollingContentsLayer());
newGraphicsLayer = compositedLayerMapping->scrollingContentsLayer();
}
}
if (m_currentGraphicsLayer != newGraphicsLayer) {
if (m_currentGraphicsLayer)
clearGraphicsLayerLinkHighlightPointer();
m_currentGraphicsLayer = newGraphicsLayer;
m_currentGraphicsLayer->addLinkHighlight(this);
}
return renderLayer;
}
示例3: webframe_scrollOverflow
QT_END_NAMESPACE
static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos)
{
if (!frame || !frame->document() || !frame->view() || !frame->eventHandler())
return false;
QPoint contentsPos = frame->view()->windowToContents(pos);
Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y());
if (!node)
return false;
RenderObject* renderer = node->renderer();
if (!renderer)
return false;
if (renderer->isListBox())
return false;
RenderLayer* renderLayer = renderer->enclosingLayer();
if (!renderLayer)
return false;
bool scrolledHorizontal = false;
bool scrolledVertical = false;
if (dx > 0)
scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx);
else if (dx < 0)
scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx));
if (dy > 0)
scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy);
else if (dy < 0)
scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy));
return (scrolledHorizontal || scrolledVertical);
}
示例4: webframe_scrollOverflow
static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy)
{
if (!frame || !frame->document() || !frame->eventHandler())
return false;
Node* node = frame->document()->focusedNode();
if (!node)
node = frame->document()->elementFromPoint(frame->eventHandler()->currentMousePosition().x(),
frame->eventHandler()->currentMousePosition().y());
if (!node)
return false;
RenderObject* renderer = node->renderer();
if (!renderer)
return false;
if (renderer->isListBox())
return false;
RenderLayer* renderLayer = renderer->enclosingLayer();
if (!renderLayer)
return false;
bool scrolledHorizontal = false;
bool scrolledVertical = false;
if (dx > 0)
scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx);
else if (dx < 0)
scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx));
if (dy > 0)
scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy);
else if (dy < 0)
scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy));
return (scrolledHorizontal || scrolledVertical);
}
示例5: 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_inRegionScrollStartingNode.get();
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_client->drawTapHighlight(region,
highlightColor.red(),
highlightColor.green(),
highlightColor.blue(),
highlightColor.alpha(),
shouldHideTapHighlightRightAfterScrolling);
}
示例6: layout
void FrameView::layout(bool allowSubtree)
{
// We should never layout a Document which is not in a LocalFrame.
ASSERT(m_frame);
ASSERT(m_frame->view() == this);
ScriptForbiddenScope forbidScript;
if (isInPerformLayout() || !m_frame->document()->isActive())
return;
TRACE_EVENT0("blink", "FrameView::layout");
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout");
// Protect the view from being deleted during layout (in recalcStyle)
RefPtr<FrameView> protector(this);
m_hasPendingLayout = false;
RELEASE_ASSERT(!isPainting());
if (!allowSubtree && isSubtreeLayout()) {
m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
m_layoutSubtreeRoot = 0;
}
performPreLayoutTasks();
// If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
// so there's no point to continuing to layout
if (protector->hasOneRef())
return;
Document* document = m_frame->document();
bool inSubtreeLayout = isSubtreeLayout();
RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : document->renderView();
if (!rootForThisLayout) {
// FIXME: Do we need to set m_size here?
ASSERT_NOT_REACHED();
return;
}
FontCachePurgePreventer fontCachePurgePreventer;
RenderLayer* layer;
{
TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
m_nestedLayoutCount++;
if (!inSubtreeLayout) {
if (m_firstLayout) {
m_firstLayout = false;
m_lastViewportSize = layoutSize();
}
m_size = LayoutSize(layoutSize());
}
layer = rootForThisLayout->enclosingLayer();
performLayout(rootForThisLayout, inSubtreeLayout);
m_layoutSubtreeRoot = 0;
} // Reset m_layoutSchedulingEnabled to its previous value.
layer->updateLayerPositionsAfterLayout();
m_layoutCount++;
ASSERT(!rootForThisLayout->needsLayout());
scheduleOrPerformPostLayoutTasks();
m_nestedLayoutCount--;
if (m_nestedLayoutCount)
return;
#if ENABLE(ASSERT)
// Post-layout assert that nobody was re-marked as needing layout during layout.
document->renderView()->assertSubtreeIsLaidOut();
#endif
}
示例7: layout
//.........这里部分代码省略.........
if (d->m_firstLayout || (hMode != currentHMode || vMode != currentVMode)) {
suppressScrollbars(true);
if (d->m_firstLayout) {
d->m_firstLayout = false;
d->m_firstLayoutCallbackPending = true;
d->m_lastLayoutSize = IntSize(width(), height());
d->m_lastZoomFactor = root->style()->zoom();
// Set the initial vMode to AlwaysOn if we're auto.
if (vMode == ScrollbarAuto)
ScrollView::setVScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
// Set the initial hMode to AlwaysOff if we're auto.
if (hMode == ScrollbarAuto)
ScrollView::setHScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
}
if (hMode == vMode)
ScrollView::setScrollbarsMode(hMode);
else {
ScrollView::setHScrollbarMode(hMode);
ScrollView::setVScrollbarMode(vMode);
}
suppressScrollbars(false, true);
}
IntSize oldSize = m_size;
m_size = IntSize(visibleWidth(), visibleHeight());
if (oldSize != m_size)
d->m_doFullRepaint = true;
}
RenderLayer* layer = root->enclosingLayer();
pauseScheduledEvents();
if (subtree)
root->view()->pushLayoutState(root);
d->m_midLayout = true;
beginDeferredRepaints();
root->layout();
endDeferredRepaints();
d->m_midLayout = false;
if (subtree)
root->view()->popLayoutState();
d->m_layoutRoot = 0;
m_frame->invalidateSelection();
d->m_layoutSchedulingEnabled = true;
if (!subtree && !static_cast<RenderView*>(root)->printing())
adjustViewSize();
// Now update the positions of all layers.
beginDeferredRepaints();
layer->updateLayerPositions(d->m_doFullRepaint);
endDeferredRepaints();
d->m_layoutCount++;
#if PLATFORM(MAC)
if (AXObjectCache::accessibilityEnabled())
root->document()->axObjectCache()->postNotificationToElement(root, "AXLayoutComplete");
#endif
#if ENABLE(DASHBOARD_SUPPORT)
updateDashboardRegions();
#endif
ASSERT(!root->needsLayout());
setStaticBackground(useSlowRepaints());
if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
updateOverflowStatus(visibleWidth() < contentsWidth(),
visibleHeight() < contentsHeight());
if (!d->m_postLayoutTasksTimer.isActive()) {
// Calls resumeScheduledEvents()
performPostLayoutTasks();
if (needsLayout()) {
// Post-layout widget updates or an event handler made us need layout again.
// Lay out again, but this time defer widget updates and event dispatch until after
// we return.
d->m_postLayoutTasksTimer.startOneShot(0);
pauseScheduledEvents();
layout();
}
} else {
resumeScheduledEvents();
ASSERT(d->m_enqueueEvents);
}
d->m_nestedLayoutCount--;
}