| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ScrollDisplayItem_h | 5 #ifndef ScrollDisplayItem_h |
| 6 #define ScrollDisplayItem_h | 6 #define ScrollDisplayItem_h |
| 7 | 7 |
| 8 #include "platform/geometry/IntSize.h" | 8 #include "platform/geometry/IntSize.h" |
| 9 #include "platform/graphics/paint/DisplayItem.h" | 9 #include "platform/graphics/paint/DisplayItem.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class PLATFORM_EXPORT BeginScrollDisplayItem final : public PairedBeginDisplayIt
em { | 14 class PLATFORM_EXPORT BeginScrollDisplayItem final : public PairedBeginDisplayIt
em<BeginScrollDisplayItem> { |
| 15 public: | 15 public: |
| 16 BeginScrollDisplayItem(const DisplayItemClient& client, Type type, const Int
Size& currentOffset) | 16 BeginScrollDisplayItem(const DisplayItemClient& client, Type type, const Int
Size& currentOffset) |
| 17 : PairedBeginDisplayItem(client, type, sizeof(*this)) | 17 : PairedBeginDisplayItem(client, type) |
| 18 , m_currentOffset(currentOffset) | 18 , m_currentOffset(currentOffset) |
| 19 { | 19 { |
| 20 ASSERT(isScrollType(type)); | 20 ASSERT(isScrollType(type)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void replay(GraphicsContext&) const override; | 23 void replay(GraphicsContext&) const override; |
| 24 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 24 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 25 | 25 |
| 26 const IntSize& currentOffset() const { return m_currentOffset; } | 26 const IntSize& currentOffset() const { return m_currentOffset; } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 #ifndef NDEBUG | 29 #ifndef NDEBUG |
| 30 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; | 30 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; |
| 31 #endif | 31 #endif |
| 32 #if ENABLE(ASSERT) | 32 #if ENABLE(ASSERT) |
| 33 bool equals(const DisplayItem& other) const final | 33 bool equals(const DisplayItem& other) const final |
| 34 { | 34 { |
| 35 return DisplayItem::equals(other) | 35 return DisplayItem::equals(other) |
| 36 && m_currentOffset == static_cast<const BeginScrollDisplayItem&>(oth
er).m_currentOffset; | 36 && m_currentOffset == static_cast<const BeginScrollDisplayItem&>(oth
er).m_currentOffset; |
| 37 } | 37 } |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 const IntSize m_currentOffset; | 40 const IntSize m_currentOffset; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class PLATFORM_EXPORT EndScrollDisplayItem final : public PairedEndDisplayItem { | 43 class PLATFORM_EXPORT EndScrollDisplayItem final : public PairedEndDisplayItem<E
ndScrollDisplayItem> { |
| 44 public: | 44 public: |
| 45 EndScrollDisplayItem(const DisplayItemClient& client, Type type) | 45 EndScrollDisplayItem(const DisplayItemClient& client, Type type) |
| 46 : PairedEndDisplayItem(client, type, sizeof(*this)) | 46 : PairedEndDisplayItem(client, type) |
| 47 { | 47 { |
| 48 ASSERT(isEndScrollType(type)); | 48 ASSERT(isEndScrollType(type)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void replay(GraphicsContext&) const override; | 51 void replay(GraphicsContext&) const override; |
| 52 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 52 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 #if ENABLE(ASSERT) | 55 #if ENABLE(ASSERT) |
| 56 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isScrollType(otherType); } | 56 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isScrollType(otherType); } |
| 57 #endif | 57 #endif |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace blink | 60 } // namespace blink |
| 61 | 61 |
| 62 #endif // ScrollDisplayItem_h | 62 #endif // ScrollDisplayItem_h |
| OLD | NEW |