Chromium Code Reviews| Index: Source/core/paint/LayerPainter.cpp |
| diff --git a/Source/core/paint/LayerPainter.cpp b/Source/core/paint/LayerPainter.cpp |
| index 4b448914adfe69fbd8df647f8ab5a00f836f9ca5..3bdd413ae59c1702df134d54dfbd574ab1876b44 100644 |
| --- a/Source/core/paint/LayerPainter.cpp |
| +++ b/Source/core/paint/LayerPainter.cpp |
| @@ -79,47 +79,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()); |
| @@ -243,7 +202,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, |
|
pdr.
2014/11/21 20:09:05
What do you think about emiting a clip here with t
|
| + paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior), m_renderLayer.renderer()->style()->blendMode(), m_renderLayer.renderer()->opacity())); |
| + } |
| LayerPaintingInfo localPaintingInfo(paintingInfo); |