// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LayoutObjectDrawingRecorder_h
#define LayoutObjectDrawingRecorder_h

#include "core/layout/PaintPhase.h"
#include "platform/geometry/FloatRect.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/paint/DisplayItem.h"
#include "platform/graphics/paint/DrawingRecorder.h"

namespace blink {

class GraphicsContext;
class LayoutObject;

class LayoutObjectDrawingRecorder {
public:
    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip)
        : m_drawingRecorder(context, layoutObject, displayItemType, pixelSnappedIntRect(clip)) { }

    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip)
        : m_drawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { }

    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type type, const FloatRect& clip)
        : m_drawingRecorder(context, layoutObject, type, clip) { }

    bool canUseCachedDrawing() const { return m_drawingRecorder.canUseCachedDrawing(); }

private:
    DrawingRecorder m_drawingRecorder;
};

} // namespace blink

#endif // LayoutObjectDrawingRecorder_h

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LayoutObjectDrawingRecorder_h
#define LayoutObjectDrawingRecorder_h

#include "core/layout/PaintPhase.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/paint/DrawingRecorder.h"

namespace blink {

class GraphicsContext;
class LayoutObject;

// Convienance constructors for creating DrawingRecorders.
class LayoutObjectDrawingRecorder final : public DrawingRecorder {
public:
    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip)
        : DrawingRecorder(context, layoutObject, displayItemType, pixelSnappedIntRect(clip)) { }

    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip)
        : DrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { }

    LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type type, const FloatRect& clip)
        : DrawingRecorder(context, layoutObject, type, clip) { }
};

} // namespace blink

#endif // LayoutObjectDrawingRecorder_h

Convert LayoutDrawingRecorder to be a simple helper of DrawingRecorder
Convert LayoutDrawingRecorder to be a simple helper of DrawingRecorder

This patch makes LayoutDrawingRecorder a non-virual subclass of
DrawingRecorder instead of carrying a DrawingRecorder member. This is
just a cleanup and should have no observable differences.

Review URL: https://codereview.chromium.org/1083223002

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@193749 bbb929c8-8fbe-4397-9dbb-9b2b20218538
