| Index: Source/core/paint/DeprecatedPaintLayerPainter.cpp
|
| diff --git a/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
|
| index 8843f3a97962cd2293c6bbe8fd5388ea989432de..2277ed4a6148cf57d473a547565357399780097f 100644
|
| --- a/Source/core/paint/DeprecatedPaintLayerPainter.cpp
|
| +++ b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
|
| @@ -212,20 +212,19 @@ void DeprecatedPaintLayerPainter::paintLayerContents(GraphicsContext* context, c
|
| // so they are nested properly.
|
| ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelativeBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags);
|
|
|
| - OwnPtr<LayerClipRecorder> clipRecorder;
|
| - OwnPtr<CompositingRecorder> compositingRecorder;
|
| + LayerClipRecorder clipRecorder(*context, DisplayItem::TransparencyClip);
|
| + CompositingRecorder compositingRecorder(*context, *m_paintLayer.layoutObject());
|
| // Blending operations must be performed only with the nearest ancestor stacking context.
|
| // Note that there is no need to composite if we're painting the root.
|
| // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWithTransparency().
|
| bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocumentElement() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingNode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode();
|
| if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paintingInfo.paintBehavior)) {
|
| - clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::TransparencyClip,
|
| + clipRecorder.begin(*m_paintLayer.layoutObject(),
|
| m_paintLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior),
|
| - &paintingInfo, LayoutPoint(), paintFlags));
|
| -
|
| - compositingRecorder = adoptPtr(new CompositingRecorder(*context, *m_paintLayer.layoutObject(),
|
| + &paintingInfo, LayoutPoint(), paintFlags);
|
| + compositingRecorder.begin(
|
| WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.layoutObject()->style()->blendMode()),
|
| - m_paintLayer.layoutObject()->opacity()));
|
| + m_paintLayer.layoutObject()->opacity());
|
| }
|
|
|
| DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo);
|
| @@ -375,10 +374,10 @@ void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte
|
|
|
| bool needsScope = fragments.size() > 1;
|
| for (const auto& fragment: fragments) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), ScopeRecorder::DeferBegin);
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| - OwnPtr<LayerClipRecorder> clipRecorder;
|
| + scopeRecorder.begin();
|
| + LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerParent);
|
| if (parentLayer) {
|
| ClipRect clipRectForFragment(ancestorBackgroundClipRect);
|
| clipRectForFragment.moveBy(fragment.paginationOffset);
|
| @@ -386,7 +385,7 @@ void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte
|
| if (clipRectForFragment.isEmpty())
|
| continue;
|
| if (needsToClip(paintingInfo, clipRectForFragment))
|
| - clipRecorder = adoptPtr(new LayerClipRecorder(*context, *parentLayer->layoutObject(), DisplayItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fragment.paginationOffset, paintFlags));
|
| + clipRecorder.begin(*parentLayer->layoutObject(), clipRectForFragment, &paintingInfo, fragment.paginationOffset, paintFlags);
|
| }
|
|
|
| paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset);
|
| @@ -457,14 +456,14 @@ void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec
|
| {
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment : layerFragments) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), ScopeRecorder::DeferBegin);
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
|
|
| - OwnPtr<LayerClipRecorder> clipRecorder;
|
| + LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerOverflowControls);
|
|
|
| if (needsToClip(localPaintingInfo, fragment.backgroundRect)) {
|
| - clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fragment.paginationOffset, paintFlags));
|
| + clipRecorder.begin(*m_paintLayer.layoutObject(), fragment.backgroundRect, &localPaintingInfo, fragment.paginationOffset, paintFlags);
|
| }
|
| if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.scrollableArea())
|
| ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
|
| @@ -612,9 +611,9 @@ void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const
|
| {
|
| ASSERT(m_paintLayer.isSelfPaintingLayer());
|
|
|
| - OwnPtr<LayerClipRecorder> clipRecorder;
|
| + DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentType(phase);
|
| + LayerClipRecorder clipRecorder(*context, clipType);
|
| if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(paintingInfo, clipRect)) {
|
| - DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentType(phase);
|
| LayerClipRecorder::BorderRadiusClippingRule clippingRule;
|
| switch (phase) {
|
| case PaintPhaseBlockBackground: // Background painting will handle clipping to self.
|
| @@ -626,12 +625,11 @@ void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const
|
| clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius;
|
| break;
|
| }
|
| -
|
| - clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.layoutObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule));
|
| + clipRecorder.begin(*m_paintLayer.layoutObject(), clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule);
|
| }
|
|
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, paintBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObject());
|
| - OwnPtr<ScrollRecorder> scrollRecorder;
|
| + ScrollRecorder scrollRecorder(*paintInfo.context, *m_paintLayer.layoutObject(), phase);
|
| LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation());
|
| if (&m_paintLayer != paintingInfo.rootLayer && paintingInfo.rootLayer->layoutObject()->hasOverflowClip()) {
|
| // As a sublayer of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorder
|
| @@ -641,7 +639,7 @@ void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const
|
| if (paintingInfo.rootLayer->scrollsOverflow() || !scrollOffset.isZero()) {
|
| paintOffset += scrollOffset;
|
| paintInfo.rect.move(scrollOffset);
|
| - scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_paintLayer.layoutObject(), paintInfo.phase, scrollOffset));
|
| + scrollRecorder.begin(scrollOffset);
|
| }
|
| }
|
| m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
|
| @@ -653,9 +651,9 @@ void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa
|
| {
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment: layerFragments) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), ScopeRecorder::DeferBegin);
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
| paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fragment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, HasNotClipped);
|
| }
|
| }
|
| @@ -667,9 +665,9 @@ void DeprecatedPaintLayerPainter::paintForegroundForFragments(const DeprecatedPa
|
| // Optimize clipping for the single fragment case.
|
| bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
|
| ClipState clipState = HasNotClipped;
|
| - OwnPtr<LayerClipRecorder> clipRecorder;
|
| + LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerForeground);
|
| if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroundRect)) {
|
| - clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags));
|
| + clipRecorder.begin(*m_paintLayer.layoutObject(), layerFragments[0].foregroundRect, &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags);
|
| clipState = HasClipped;
|
| }
|
|
|
| @@ -691,9 +689,9 @@ void DeprecatedPaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhas
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment: layerFragments) {
|
| if (!fragment.foregroundRect.isEmpty()) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), ScopeRecorder::DeferBegin);
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
| paintFragmentWithPhase(phase, fragment, context, fragment.foregroundRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, clipState);
|
| }
|
| }
|
| @@ -705,9 +703,9 @@ void DeprecatedPaintLayerPainter::paintOutlineForFragments(const DeprecatedPaint
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment: layerFragments) {
|
| if (!fragment.outlineRect.isEmpty()) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
| paintFragmentWithPhase(PaintPhaseSelfOutline, fragment, context, fragment.outlineRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, HasNotClipped);
|
| }
|
| }
|
| @@ -718,9 +716,9 @@ void DeprecatedPaintLayerPainter::paintMaskForFragments(const DeprecatedPaintLay
|
| {
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment: layerFragments) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
| paintFragmentWithPhase(PaintPhaseMask, fragment, context, fragment.backgroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayoutObject, paintFlags, HasNotClipped);
|
| }
|
| }
|
| @@ -730,9 +728,9 @@ void DeprecatedPaintLayerPainter::paintChildClippingMaskForFragments(const Depre
|
| {
|
| bool needsScope = layerFragments.size() > 1;
|
| for (auto& fragment: layerFragments) {
|
| - OwnPtr<ScopeRecorder> scopeRecorder;
|
| + ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
|
| if (needsScope)
|
| - scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.layoutObject()));
|
| + scopeRecorder.begin();
|
| paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragment.foregroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayoutObject, paintFlags, HasNotClipped);
|
| }
|
| }
|
|
|