本文整理汇总了C++中FrameView::containsScrollableArea方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::containsScrollableArea方法的具体用法?C++ FrameView::containsScrollableArea怎么用?C++ FrameView::containsScrollableArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::containsScrollableArea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: requiresCompositingForPosition
bool CompositingReasonFinder::requiresCompositingForPosition(RenderObject* renderer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason, bool* needToRecomputeCompositingRequirements) const
{
// position:fixed elements that create their own stacking context (e.g. have an explicit z-index,
// opacity, transform) can get their own composited layer. A stacking context is required otherwise
// z-index and clipping will be broken.
if (!renderer->isPositioned())
return false;
EPosition position = renderer->style()->position();
bool isFixed = renderer->isOutOfFlowPositioned() && position == FixedPosition;
// FIXME: The isStackingContainer check here is redundant. Fixed position elements are always stacking contexts.
if (isFixed && !layer->stackingNode()->isStackingContainer())
return false;
bool isSticky = renderer->isInFlowPositioned() && position == StickyPosition;
if (!isFixed && !isSticky)
return false;
// FIXME: acceleratedCompositingForFixedPositionEnabled should probably be renamed acceleratedCompositingForViewportConstrainedPositionEnabled().
if (Settings* settings = m_renderView.document().settings()) {
if (!settings->acceleratedCompositingForFixedPositionEnabled())
return false;
}
if (isSticky)
return isViewportConstrainedFixedOrStickyLayer(layer);
RenderObject* container = renderer->container();
// If the renderer is not hooked up yet then we have to wait until it is.
if (!container) {
*needToRecomputeCompositingRequirements = true;
return false;
}
// Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
// They will stay fixed wrt the container rather than the enclosing frame.
if (container != &m_renderView) {
if (viewportConstrainedNotCompositedReason)
*viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNonViewContainer;
return false;
}
// If the fixed-position element does not have any scrollable ancestor between it and
// its container, then we do not need to spend compositor resources for it. Start by
// assuming we can opt-out (i.e. no scrollable ancestor), and refine the answer below.
bool hasScrollableAncestor = false;
// The FrameView has the scrollbars associated with the top level viewport, so we have to
// check the FrameView in addition to the hierarchy of ancestors.
FrameView* frameView = m_renderView.frameView();
if (frameView && frameView->isScrollable())
hasScrollableAncestor = true;
RenderLayer* ancestor = layer->parent();
while (ancestor && !hasScrollableAncestor) {
if (frameView->containsScrollableArea(ancestor->scrollableArea()))
hasScrollableAncestor = true;
if (ancestor->renderer() == &m_renderView)
break;
ancestor = ancestor->parent();
}
if (!hasScrollableAncestor) {
if (viewportConstrainedNotCompositedReason)
*viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForUnscrollableAncestors;
return false;
}
// Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
if (m_renderView.document().lifecycle().state() < DocumentLifecycle::LayoutClean) {
*needToRecomputeCompositingRequirements = true;
return layer->hasCompositedLayerMapping();
}
bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescendant();
if (!paintsContent) {
if (viewportConstrainedNotCompositedReason)
*viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNoVisibleContent;
return false;
}
// Fixed position elements that are invisible in the current view don't get their own layer.
if (FrameView* frameView = m_renderView.frameView()) {
LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect();
LayoutRect layerBounds = layer->calculateLayerBounds(layer->compositor()->rootRenderLayer(), 0,
RenderLayer::DefaultCalculateLayerBoundsFlags
| RenderLayer::ExcludeHiddenDescendants
| RenderLayer::DontConstrainForMask
| RenderLayer::IncludeCompositedDescendants
| RenderLayer::PretendLayerHasOwnBacking);
if (!viewBounds.intersects(enclosingIntRect(layerBounds))) {
if (viewportConstrainedNotCompositedReason) {
*viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
*needToRecomputeCompositingRequirements = true;
}
return false;
}
}
return true;
//.........这里部分代码省略.........