| 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 "core/paint/ReplicaPainter.h" | 5 #include "core/paint/ReplicaPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutReplica.h" | 7 #include "core/layout/LayoutReplica.h" |
| 8 #include "core/paint/LayoutObjectDrawingRecorder.h" | 8 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
| 10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| 11 #include "core/paint/PaintLayerPainter.h" | 11 #include "core/paint/PaintLayerPainter.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 15 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| 16 { | 16 { |
| 17 // PaintLayerReflectionInfo should have set a transform on the LayoutReplica
. | 17 // PaintLayerReflectionInfo should have set a transform on the LayoutReplica
. |
| 18 // Without it, we won't paint the reflection correctly. | 18 // Without it, we won't paint the reflection correctly. |
| 19 ASSERT(m_layoutReplica.layer()->transform()); | 19 ASSERT(m_layoutReplica.layer()->transform()); |
| 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_layoutReplica.location(); | 24 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplica.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 PaintLayer* rootPaintingLayer = m_layoutReplica.layer()->parent(); | 29 PaintLayer* rootPaintingLayer = m_layoutReplica.layer()->parent(); |
| 30 PaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintI
nfo.cullRect().m_rect), GlobalPaintNormalPhase, LayoutSize(), 0); | 30 PaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintI
nfo.cullRect().m_rect), GlobalPaintNormalPhase, LayoutSize()); |
| 31 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; | 31 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr
ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; |
| 32 PaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintIn
fo.context, paintingInfo, flags); | 32 PaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintIn
fo.context, paintingInfo, flags); |
| 33 } else if (paintInfo.phase == PaintPhaseMask) { | 33 } else if (paintInfo.phase == PaintPhaseMask) { |
| 34 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset); | 34 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |