Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / paint / FloatClipRecorder.cpp
blob8e2a9b20f899755910d37ea76b6d3ff1065ac727
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.
5 #include "config.h"
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"
12 namespace blink {
14 FloatClipRecorder::FloatClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase paintPhase, const FloatRect& clipRect)
15 : m_context(context)
16 , m_client(client)
17 , m_clipType(DisplayItem::paintPhaseToFloatClipType(paintPhase))
19 ASSERT(m_context.displayItemList());
20 if (m_context.displayItemList()->displayItemConstructionIsDisabled())
21 return;
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();
32 else
33 m_context.displayItemList()->createAndAppend<EndFloatClipDisplayItem>(m_client, endType);
37 } // namespace blink