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/rendering/ClipPathOperation.h" | 10 #include "core/rendering/ClipPathOperation.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingI
nfo.paintDirtyRect, clipRect); | 108 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingI
nfo.paintDirtyRect, clipRect); |
109 | 109 |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 113 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
114 } | 114 } |
115 | 115 |
116 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende
rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA
ccumulation, PaintBehavior paintBehavior) | 116 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende
rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA
ccumulation, PaintBehavior paintBehavior) |
117 { | 117 { |
118 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS
tackingContext() && m_renderLayer.hasDescendantWithBlendMode(); | 118 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS
tackingContext() && m_renderLayer.hasNonIsolatedDescendantWithBlendMode(); |
119 if ((m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pa
intsWithBlendMode() || createTransparencyLayerForBlendMode) && m_renderLayer.use
dTransparency()) | 119 if ((m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pa
intsWithBlendMode() || createTransparencyLayerForBlendMode) && m_renderLayer.use
dTransparency()) |
120 return; | 120 return; |
121 | 121 |
122 RenderLayer* ancestor = m_renderLayer.transparentPaintingAncestor(); | 122 RenderLayer* ancestor = m_renderLayer.transparentPaintingAncestor(); |
123 if (ancestor) | 123 if (ancestor) |
124 LayerPainter(*ancestor).beginTransparencyLayers(context, rootLayer, pain
tDirtyRect, subPixelAccumulation, paintBehavior); | 124 LayerPainter(*ancestor).beginTransparencyLayers(context, rootLayer, pain
tDirtyRect, subPixelAccumulation, paintBehavior); |
125 | 125 |
126 if (m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pai
ntsWithBlendMode() || createTransparencyLayerForBlendMode) { | 126 if (m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pai
ntsWithBlendMode() || createTransparencyLayerForBlendMode) { |
127 m_renderLayer.setUsedTransparency(true); | 127 m_renderLayer.setUsedTransparency(true); |
128 context->save(); | 128 context->save(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 paintingInfo.paintDirtyRect, context, clipperState)) { | 240 paintingInfo.paintDirtyRect, context, clipperState)) { |
241 // No need to post-apply the clipper if this failed. | 241 // No need to post-apply the clipper if this failed. |
242 resourceClipper = 0; | 242 resourceClipper = 0; |
243 } | 243 } |
244 } | 244 } |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 // Blending operations must be performed only with the nearest ancestor stac
king context. | 248 // Blending operations must be performed only with the nearest ancestor stac
king context. |
249 // Note that there is no need to create a transparency layer if we're painti
ng the root. | 249 // Note that there is no need to create a transparency layer if we're painti
ng the root. |
250 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu
mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa
yer.hasDescendantWithBlendMode(); | 250 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu
mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa
yer.hasNonIsolatedDescendantWithBlendMode(); |
251 | 251 |
252 if (createTransparencyLayerForBlendMode) | 252 if (createTransparencyLayerForBlendMode) |
253 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); | 253 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
254 | 254 |
255 LayerPaintingInfo localPaintingInfo(paintingInfo); | 255 LayerPaintingInfo localPaintingInfo(paintingInfo); |
256 bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.pain
tsWithFilters(); | 256 bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.pain
tsWithFilters(); |
257 | 257 |
258 LayerFragments layerFragments; | 258 LayerFragments layerFragments; |
259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ | 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ |
260 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment, as well as whether or not the content of each | 260 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment, as well as whether or not the content of each |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 clipRect.intersect(parentClipRect); | 841 clipRect.intersect(parentClipRect); |
842 } | 842 } |
843 | 843 |
844 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context,
clipRect, paintFlags); | 844 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context,
clipRect, paintFlags); |
845 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); | 845 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); |
846 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo.
paintDirtyRect, clipRect); | 846 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo.
paintDirtyRect, clipRect); |
847 } | 847 } |
848 } | 848 } |
849 | 849 |
850 } // namespace blink | 850 } // namespace blink |
OLD | NEW |