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/ReplicaPainter.h" | 6 #include "core/paint/ReplicaPainter.h" |
7 | 7 |
| 8 #include "core/layout/Layer.h" |
8 #include "core/paint/GraphicsContextAnnotator.h" | 9 #include "core/paint/GraphicsContextAnnotator.h" |
9 #include "core/paint/LayerPainter.h" | 10 #include "core/paint/LayerPainter.h" |
10 #include "core/paint/RenderDrawingRecorder.h" | 11 #include "core/paint/RenderDrawingRecorder.h" |
11 #include "core/rendering/PaintInfo.h" | 12 #include "core/rendering/PaintInfo.h" |
12 #include "core/rendering/RenderLayer.h" | |
13 #include "core/rendering/RenderReplica.h" | 13 #include "core/rendering/RenderReplica.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 17 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
18 { | 18 { |
19 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderReplica); | 19 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderReplica); |
20 | 20 |
21 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Mask) | 21 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Mask) |
22 return; | 22 return; |
23 | 23 |
24 LayoutPoint adjustedPaintOffset = paintOffset + m_renderReplica.location(); | 24 LayoutPoint adjustedPaintOffset = paintOffset + m_renderReplica.location(); |
25 | 25 |
26 if (paintInfo.phase == PaintPhaseForeground) { | 26 if (paintInfo.phase == PaintPhaseForeground) { |
27 // Turn around and paint the parent layer. Use temporary clipRects, so t
hat the layer doesn't end up caching clip rects | 27 // Turn around and paint the parent layer. Use temporary clipRects, so t
hat the layer doesn't end up caching clip rects |
28 // computing using the wrong rootLayer | 28 // computing using the wrong rootLayer |
29 RenderLayer* rootPaintingLayer = m_renderReplica.layer()->transform() ?
m_renderReplica.layer()->parent() : m_renderReplica.layer()->enclosingTransforme
dAncestor(); | 29 Layer* rootPaintingLayer = m_renderReplica.layer()->transform() ? m_rend
erReplica.layer()->parent() : m_renderReplica.layer()->enclosingTransformedAnces
tor(); |
30 LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintB
ehaviorNormal, LayoutSize(), 0); | 30 LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintB
ehaviorNormal, LayoutSize(), 0); |
31 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; | 31 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; |
32 LayerPainter(*m_renderReplica.layer()->parent()).paintLayer(paintInfo.co
ntext, paintingInfo, flags); | 32 LayerPainter(*m_renderReplica.layer()->parent()).paintLayer(paintInfo.co
ntext, paintingInfo, flags); |
33 } else if (paintInfo.phase == PaintPhaseMask) { | 33 } else if (paintInfo.phase == PaintPhaseMask) { |
34 LayoutRect paintRect(adjustedPaintOffset, m_renderReplica.size()); | 34 LayoutRect paintRect(adjustedPaintOffset, m_renderReplica.size()); |
35 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_renderR
eplica, paintInfo.phase, paintRect); | 35 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_renderR
eplica, paintInfo.phase, paintRect); |
36 m_renderReplica.paintMask(paintInfo, adjustedPaintOffset); | 36 m_renderReplica.paintMask(paintInfo, adjustedPaintOffset); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 } // namespace blink | 40 } // namespace blink |
OLD | NEW |