static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects) { ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip() || layoutObject.style()->containsPaint()); LayoutView* view = layoutObject.view(); ASSERT(view); if (clipRects.fixed() && context.rootLayer->layoutObject() == view) offset -= toIntSize(view->frameView()->scrollPosition()); if (layoutObject.hasOverflowClip() || layoutObject.style()->containsPaint()) { ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(offset, context.scrollbarRelevancy); newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius()); clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); if (layoutObject.isPositioned()) clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect())); if (layoutObject.isLayoutView()) clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect())); if (layoutObject.style()->containsPaint()) { clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect())); clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect())); } } if (layoutObject.hasClip()) { LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowClipRect()).setIsClippedByClipCss()); clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()).setIsClippedByClipCss()); } }
ClipRect PaintLayerClipper::backgroundClipRect( const ClipRectsContext& context) const { if (m_geometryMapper) { ClipRect backgroundClipRect = clipRectWithGeometryMapper(context, false); #ifdef CHECK_CLIP_RECTS ClipRect testBackgroundClipRect = PaintLayerClipper(m_layer, false).backgroundClipRect(context); CHECK_RECTS_EQ(testBackgroundClipRect, backgroundClipRect); #endif return backgroundClipRect; } DCHECK(m_layer.parent()); LayoutView* layoutView = m_layer.layoutObject()->view(); DCHECK(layoutView); RefPtr<ClipRects> parentClipRects = ClipRects::create(); if (&m_layer == context.rootLayer) parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect())); else m_layer.parent()->clipper().getOrCalculateClipRects(context, *parentClipRects); ClipRect result = backgroundClipRectForPosition( *parentClipRects, m_layer.layoutObject()->styleRef().position()); // Note: infinite clipRects should not be scrolled here, otherwise they will // accidentally no longer be considered infinite. if (parentClipRects->fixed() && context.rootLayer->layoutObject() == layoutView && result != LayoutRect(LayoutRect::infiniteIntRect())) result.move(LayoutSize(layoutView->frameView()->scrollOffset())); return result; }
PaintLayerCompositor::PaintLayerCompositor(LayoutView& layoutView) : m_layoutView(layoutView) , m_compositingReasonFinder(layoutView) , m_pendingUpdateType(CompositingUpdateNone) , m_hasAcceleratedCompositing(true) , m_compositing(false) , m_rootShouldAlwaysCompositeDirty(true) , m_needsUpdateFixedBackground(false) , m_isTrackingPaintInvalidations(layoutView.frameView()->isTrackingPaintInvalidations()) , m_inOverlayFullscreenVideo(false) , m_needsUpdateDescendantDependentFlags(false) , m_rootLayerAttachment(RootLayerUnattached) { updateAcceleratedCompositingSettings(); }
static void applyClipRects(const ClipRectsContext& context, const LayoutBoxModelObject& layoutObject, LayoutPoint offset, ClipRects& clipRects) { DCHECK(layoutObject.hasClipRelatedProperty() || (layoutObject.isSVGRoot() && toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())); LayoutView* view = layoutObject.view(); DCHECK(view); if (clipRects.fixed() && context.rootLayer->layoutObject() == view) offset -= LayoutSize(view->frameView()->scrollOffset()); if (layoutObject.hasOverflowClip() || (layoutObject.isSVGRoot() && toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) || (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) { ClipRect newOverflowClip = toLayoutBox(layoutObject) .overflowClipRect(offset, context.overlayScrollbarClipBehavior); newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius()); clipRects.setOverflowClipRect( intersection(newOverflowClip, clipRects.overflowClipRect())); if (layoutObject.isPositioned()) clipRects.setPosClipRect( intersection(newOverflowClip, clipRects.posClipRect())); if (layoutObject.isLayoutView()) clipRects.setFixedClipRect( intersection(newOverflowClip, clipRects.fixedClipRect())); if (layoutObject.styleRef().containsPaint()) { clipRects.setPosClipRect( intersection(newOverflowClip, clipRects.posClipRect())); clipRects.setFixedClipRect( intersection(newOverflowClip, clipRects.fixedClipRect())); } } if (layoutObject.hasClip()) { LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); clipRects.setPosClipRect( intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); clipRects.setOverflowClipRect( intersection(newClip, clipRects.overflowClipRect()) .setIsClippedByClipCss()); clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) .setIsClippedByClipCss()); } }