Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/LayerPainter.h" | 6 #include "core/paint/LayerPainter.h" |
| 7 | 7 |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 #include "core/paint/FilterPainter.h" | 10 #include "core/paint/FilterPainter.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 } | 99 } |
| 100 | 100 |
| 101 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 101 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
| 102 | 102 |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 | 105 |
| 106 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 106 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static inline WebBlendMode blendModeForRenderer(const RenderObject& renderer) | |
| 110 { | |
| 111 // RenderObject::hasBlendMode is gated on RuntimeEnabledFeatures::cssComposi tingEnabled, | |
| 112 // otherwise the true-clause alone would suffice. | |
| 113 return renderer.hasBlendMode() ? renderer.style()->blendMode() : WebBlendMod eNormal; | |
|
Julien - ping for review
2014/11/19 19:16:05
RenderStyle::blendMode() is gated on cssCompositin
chrishtr
2014/11/19 19:24:09
Let's get rid of all of the hasBlendMode() methods
fs
2014/11/20 09:09:46
Ah, but of course... Thanks, fixed.
| |
| 114 } | |
| 115 | |
| 109 class TransparencyLayerHelper { | 116 class TransparencyLayerHelper { |
| 110 public: | 117 public: |
| 111 TransparencyLayerHelper(GraphicsContext* context, RenderLayer& renderLayer, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize & subPixelAccumulation, PaintBehavior paintBehavior) | 118 TransparencyLayerHelper(GraphicsContext* context, RenderLayer& renderLayer, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize & subPixelAccumulation, PaintBehavior paintBehavior) |
| 112 : m_transparencyLayerInProgress(false) | 119 : m_transparencyLayerInProgress(false) |
| 113 , m_context(context) | 120 , m_context(context) |
| 114 , m_renderLayer(renderLayer) | 121 , m_renderLayer(renderLayer) |
| 115 { | 122 { |
| 116 // Blending operations must be performed only with the nearest ancestor stacking context. | 123 // Blending operations must be performed only with the nearest ancestor stacking context. |
| 117 // Note that there is no need to create a transparency layer if we're pa inting the root. | 124 // Note that there is no need to create a transparency layer if we're pa inting the root. |
| 118 // FIXME: this should be unified further into RenderLayer::paintsWithTra nsparency(). | 125 // FIXME: this should be unified further into RenderLayer::paintsWithTra nsparency(). |
| 119 bool shouldUseTransparencyLayerForBlendMode = !renderLayer.renderer()->i sDocumentElement() && renderLayer.stackingNode()->isStackingContext() && renderL ayer.hasNonIsolatedDescendantWithBlendMode(); | 126 bool shouldUseTransparencyLayerForBlendMode = !renderLayer.renderer()->i sDocumentElement() && renderLayer.stackingNode()->isStackingContext() && renderL ayer.hasNonIsolatedDescendantWithBlendMode(); |
| 120 if (!shouldUseTransparencyLayerForBlendMode && !renderLayer.paintsWithTr ansparency(paintBehavior)) | 127 if (!shouldUseTransparencyLayerForBlendMode && !renderLayer.paintsWithTr ansparency(paintBehavior)) |
| 121 return; | 128 return; |
| 122 | 129 |
| 123 OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adop tPtr(new BeginTransparencyDisplayItem( | 130 OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adop tPtr(new BeginTransparencyDisplayItem( |
| 124 renderLayer.renderer(), DisplayItem::BeginTransparency, renderLayer. paintingExtent(rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior), | 131 renderLayer.renderer(), DisplayItem::BeginTransparency, renderLayer. paintingExtent(rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior), |
| 125 renderLayer.renderer()->hasBlendMode(), renderLayer.renderer()->styl e()->blendMode(), renderLayer.renderer()->opacity())); | 132 blendModeForRenderer(*renderLayer.renderer()), renderLayer.renderer( )->opacity())); |
| 126 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 133 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 127 renderLayer.renderer()->view()->viewDisplayList().add(beginTranspare ncyDisplayItem.release()); | 134 renderLayer.renderer()->view()->viewDisplayList().add(beginTranspare ncyDisplayItem.release()); |
| 128 else | 135 else |
| 129 beginTransparencyDisplayItem->replay(context); | 136 beginTransparencyDisplayItem->replay(context); |
| 130 | 137 |
| 131 m_transparencyLayerInProgress = true; | 138 m_transparencyLayerInProgress = true; |
| 132 } | 139 } |
| 133 | 140 |
| 134 ~TransparencyLayerHelper() | 141 ~TransparencyLayerHelper() |
| 135 { | 142 { |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 | 761 |
| 755 OwnPtr<ClipRecorder> clipRecorder; | 762 OwnPtr<ClipRecorder> clipRecorder; |
| 756 if (needsToClip(paintingInfo, clipRect)) | 763 if (needsToClip(paintingInfo, clipRect)) |
| 757 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c ontext, DisplayItem::ClipLayerFragmentParent, clipRect, &paintingInfo, LayoutPoi nt(), paintFlags)); | 764 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c ontext, DisplayItem::ClipLayerFragmentParent, clipRect, &paintingInfo, LayoutPoi nt(), paintFlags)); |
| 758 | 765 |
| 759 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 766 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
| 760 } | 767 } |
| 761 } | 768 } |
| 762 | 769 |
| 763 } // namespace blink | 770 } // namespace blink |
| OLD | NEW |