Home | History | Annotate | Download | only in paint
      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.
      4 
      5 #include "config.h"
      6 #include "core/paint/ReplicaPainter.h"
      7 
      8 #include "core/rendering/GraphicsContextAnnotator.h"
      9 #include "core/rendering/PaintInfo.h"
     10 #include "core/rendering/RenderLayer.h"
     11 #include "core/rendering/RenderReplica.h"
     12 
     13 namespace blink {
     14 
     15 void ReplicaPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
     16 {
     17     ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderReplica);
     18 
     19     if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseMask)
     20         return;
     21 
     22     LayoutPoint adjustedPaintOffset = paintOffset + m_renderReplica.location();
     23 
     24     if (paintInfo.phase == PaintPhaseForeground) {
     25         // Turn around and paint the parent layer. Use temporary clipRects, so that the layer doesn't end up caching clip rects
     26         // computing using the wrong rootLayer
     27         RenderLayer* rootPaintingLayer = m_renderReplica.layer()->transform() ? m_renderReplica.layer()->parent() : m_renderReplica.layer()->enclosingTransformedAncestor();
     28         LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0);
     29         PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTransform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection;
     30         m_renderReplica.layer()->parent()->paintLayer(paintInfo.context, paintingInfo, flags);
     31     } else if (paintInfo.phase == PaintPhaseMask) {
     32         m_renderReplica.paintMask(paintInfo, adjustedPaintOffset);
     33     }
     34 }
     35 
     36 } // namespace blink
     37