| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/ScrollRecorder.h" | 5 #include "core/paint/ScrollRecorder.h" |
| 6 | 6 |
| 7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
| 8 #include "platform/graphics/paint/PaintController.h" | 8 #include "platform/graphics/paint/PaintController.h" |
| 9 #include "platform/graphics/paint/ScrollDisplayItem.h" | 9 #include "platform/graphics/paint/ScrollDisplayItem.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 ScrollRecorder::ScrollRecorder(GraphicsContext& context, | 13 ScrollRecorder::ScrollRecorder(GraphicsContext& context, |
| 14 const DisplayItemClient& client, | 14 const DisplayItemClient& client, |
| 15 DisplayItem::Type type, | 15 DisplayItem::Type type, |
| 16 const IntSize& currentOffset) | 16 const IntSize& currentOffset) |
| 17 : m_client(client), m_beginItemType(type), m_context(context) { | 17 : m_client(client), m_beginItemType(type), m_context(context) { |
| 18 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 19 return; |
| 18 m_context.getPaintController().createAndAppend<BeginScrollDisplayItem>( | 20 m_context.getPaintController().createAndAppend<BeginScrollDisplayItem>( |
| 19 m_client, m_beginItemType, currentOffset); | 21 m_client, m_beginItemType, currentOffset); |
| 20 } | 22 } |
| 21 | 23 |
| 22 ScrollRecorder::ScrollRecorder(GraphicsContext& context, | 24 ScrollRecorder::ScrollRecorder(GraphicsContext& context, |
| 23 const DisplayItemClient& client, | 25 const DisplayItemClient& client, |
| 24 PaintPhase phase, | 26 PaintPhase phase, |
| 25 const IntSize& currentOffset) | 27 const IntSize& currentOffset) |
| 26 : ScrollRecorder(context, | 28 : ScrollRecorder(context, |
| 27 client, | 29 client, |
| 28 DisplayItem::paintPhaseToScrollType(phase), | 30 DisplayItem::paintPhaseToScrollType(phase), |
| 29 currentOffset) {} | 31 currentOffset) {} |
| 30 | 32 |
| 31 ScrollRecorder::~ScrollRecorder() { | 33 ScrollRecorder::~ScrollRecorder() { |
| 34 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 35 return; |
| 32 m_context.getPaintController().endItem<EndScrollDisplayItem>( | 36 m_context.getPaintController().endItem<EndScrollDisplayItem>( |
| 33 m_client, DisplayItem::scrollTypeToEndScrollType(m_beginItemType)); | 37 m_client, DisplayItem::scrollTypeToEndScrollType(m_beginItemType)); |
| 34 } | 38 } |
| 35 | 39 |
| 36 } // namespace blink | 40 } // namespace blink |
| OLD | NEW |