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
3 // found in the LICENSE file.
6 #include "core/paint/ReplicaPainter.h"
8 #include "core/paint/LayerPainter.h"
9 #include "core/rendering/GraphicsContextAnnotator.h"
10 #include "core/rendering/PaintInfo.h"
11 #include "core/rendering/RenderLayer.h"
12 #include "core/rendering/RenderReplica.h"
16 void ReplicaPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
18 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderReplica);
20 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseMask)
23 LayoutPoint adjustedPaintOffset = paintOffset + m_renderReplica.location();
25 if (paintInfo.phase == PaintPhaseForeground) {
26 // Turn around and paint the parent layer. Use temporary clipRects, so that the layer doesn't end up caching clip rects
27 // computing using the wrong rootLayer
28 RenderLayer* rootPaintingLayer = m_renderReplica.layer()->transform() ? m_renderReplica.layer()->parent() : m_renderReplica.layer()->enclosingTransformedAncestor();
29 LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0);
30 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTransform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection;
31 LayerPainter(*m_renderReplica.layer()->parent()).paintLayer(paintInfo.context, paintingInfo, flags);
32 } else if (paintInfo.phase == PaintPhaseMask) {
33 m_renderReplica.paintMask(paintInfo, adjustedPaintOffset);