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/FloatClipRecorder.h"
8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/DisplayItemList.h"
10 #include "platform/graphics/paint/FloatClipDisplayItem.h"
14 FloatClipRecorder::FloatClipRecorder(GraphicsContext
& context
, const DisplayItemClientWrapper
& client
, PaintPhase paintPhase
, const FloatRect
& clipRect
)
17 , m_clipType(DisplayItem::paintPhaseToFloatClipType(paintPhase
))
19 ASSERT(m_context
.displayItemList());
20 if (m_context
.displayItemList()->displayItemConstructionIsDisabled())
22 m_context
.displayItemList()->createAndAppend
<FloatClipDisplayItem
>(m_client
, m_clipType
, clipRect
);
25 FloatClipRecorder::~FloatClipRecorder()
27 DisplayItem::Type endType
= DisplayItem::floatClipTypeToEndFloatClipType(m_clipType
);
28 ASSERT(m_context
.displayItemList());
29 if (!m_context
.displayItemList()->displayItemConstructionIsDisabled()) {
30 if (m_context
.displayItemList()->lastDisplayItemIsNoopBegin())
31 m_context
.displayItemList()->removeLastDisplayItem();
33 m_context
.displayItemList()->createAndAppend
<EndFloatClipDisplayItem
>(m_client
, endType
);