Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / paint / ScrollRecorder.cpp
blob7900c2cd064c968005c143a3bd51adb70cd5f5d5
1 // Copyright 2015 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/ScrollRecorder.h"
8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/DisplayItemList.h"
10 #include "platform/graphics/paint/ScrollDisplayItem.h"
12 namespace blink {
14 ScrollRecorder::ScrollRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase phase, const IntSize& currentOffset)
15 : m_client(client)
16 , m_beginItemType(DisplayItem::paintPhaseToScrollType(phase))
17 , m_context(context)
19 ASSERT(m_context.displayItemList());
20 if (m_context.displayItemList()->displayItemConstructionIsDisabled())
21 return;
22 m_context.displayItemList()->createAndAppend<BeginScrollDisplayItem>(m_client, m_beginItemType, currentOffset);
25 ScrollRecorder::~ScrollRecorder()
27 ASSERT(m_context.displayItemList());
28 if (!m_context.displayItemList()->displayItemConstructionIsDisabled()) {
29 if (m_context.displayItemList()->lastDisplayItemIsNoopBegin())
30 m_context.displayItemList()->removeLastDisplayItem();
31 else
32 m_context.displayItemList()->createAndAppend<EndScrollDisplayItem>(m_client, DisplayItem::scrollTypeToEndScrollType(m_beginItemType));
36 } // namespace blink