Index: Source/core/paint/LayerPainter.cpp |
diff --git a/Source/core/paint/LayerPainter.cpp b/Source/core/paint/LayerPainter.cpp |
index 132f05091df16eb51ce9739a29fa4dd29ad7217b..d7067ffe6c9377a02122cdd09c23280b123a76d7 100644 |
--- a/Source/core/paint/LayerPainter.cpp |
+++ b/Source/core/paint/LayerPainter.cpp |
@@ -106,47 +106,6 @@ void LayerPainter::paintLayer(GraphicsContext* context, const LayerPaintingInfo& |
paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
} |
-class TransparencyLayerHelper { |
-public: |
- TransparencyLayerHelper(GraphicsContext* context, RenderLayer& renderLayer, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior) |
- : m_transparencyLayerInProgress(false) |
- , m_context(context) |
- , m_renderLayer(renderLayer) |
- { |
- // Blending operations must be performed only with the nearest ancestor stacking context. |
- // Note that there is no need to create a transparency layer if we're painting the root. |
- // FIXME: this should be unified further into RenderLayer::paintsWithTransparency(). |
- bool shouldUseTransparencyLayerForBlendMode = !renderLayer.renderer()->isDocumentElement() && renderLayer.stackingNode()->isStackingContext() && renderLayer.hasNonIsolatedDescendantWithBlendMode(); |
- if (!shouldUseTransparencyLayerForBlendMode && !renderLayer.paintsWithTransparency(paintBehavior)) |
- return; |
- |
- OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adoptPtr(new BeginTransparencyDisplayItem( |
- renderLayer.renderer(), DisplayItem::BeginTransparency, renderLayer.paintingExtent(rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior), |
- renderLayer.renderer()->style()->blendMode(), renderLayer.renderer()->opacity())); |
- if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
- renderLayer.renderer()->view()->viewDisplayList().add(beginTransparencyDisplayItem.release()); |
- else |
- beginTransparencyDisplayItem->replay(context); |
- |
- m_transparencyLayerInProgress = true; |
- } |
- |
- ~TransparencyLayerHelper() |
- { |
- if (!m_transparencyLayerInProgress) |
- return; |
- OwnPtr<EndTransparencyDisplayItem> endTransparencyDisplayItem = adoptPtr(new EndTransparencyDisplayItem(m_renderLayer.renderer(), DisplayItem::EndTransparency)); |
- if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
- m_renderLayer.renderer()->view()->viewDisplayList().add(endTransparencyDisplayItem.release()); |
- else |
- endTransparencyDisplayItem->replay(m_context); |
- } |
-private: |
- bool m_transparencyLayerInProgress; |
- GraphicsContext* m_context; |
- const RenderLayer& m_renderLayer; |
-}; |
- |
void LayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
{ |
ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingLayerDescendant()); |
@@ -270,7 +229,16 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint |
// These helpers output clip and transparency layers using a RAII pattern. Stack-allocated-varibles are destructed in the reverse order of construction, |
// so they are nested properly. |
ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRelativeBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); |
- TransparencyLayerHelper transparencyLayerHelper(context, m_renderLayer, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
+ |
+ OwnPtr<TransparencyRecorder> transparencyRecorder; |
+ // Blending operations must be performed only with the nearest ancestor stacking context. |
+ // Note that there is no need to create a transparency layer if we're painting the root. |
+ // FIXME: this should be unified further into RenderLayer::paintsWithTransparency(). |
+ bool shouldUseTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocumentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLayer.hasNonIsolatedDescendantWithBlendMode(); |
+ if (shouldUseTransparencyLayerForBlendMode || m_renderLayer.paintsWithTransparency(paintingInfo.paintBehavior)) { |
+ transparencyRecorder = adoptPtr(new TransparencyRecorder(context, m_renderLayer.renderer(), DisplayItem::BeginTransparency, m_renderLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.paintDirtyRect, |
+ paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior), m_renderLayer.renderer()->style()->blendMode(), m_renderLayer.renderer()->opacity())); |
+ } |
LayerPaintingInfo localPaintingInfo(paintingInfo); |