| 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/FastAllocBase.h" | 10 #include "wtf/FastAllocBase.h" |
| 11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class PLATFORM_EXPORT BeginScrollDisplayItem final : public PairedBeginDisplayIt
em { | 15 class PLATFORM_EXPORT BeginScrollDisplayItem final : public PairedBeginDisplayIt
em { |
| 16 public: | 16 public: |
| 17 BeginScrollDisplayItem(const DisplayItemClientWrapper& client, Type type, co
nst IntSize& currentOffset) | 17 BeginScrollDisplayItem(const DisplayItemClientWrapper& client, Type type, co
nst IntSize& currentOffset) |
| 18 : PairedBeginDisplayItem(client, type, sizeof(*this)) | 18 : PairedBeginDisplayItem(client, type, sizeof(*this)) |
| 19 , m_currentOffset(currentOffset) | 19 , m_currentOffset(currentOffset) |
| 20 { | 20 { |
| 21 ASSERT(isScrollType(type)); | 21 ASSERT(isScrollType(type)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void replay(GraphicsContext&) override; | 24 void replay(GraphicsContext&) override; |
| 25 void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 25 void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 26 | 26 |
| 27 const IntSize& currentOffset() const { return m_currentOffset; } |
| 28 |
| 27 private: | 29 private: |
| 28 #ifndef NDEBUG | 30 #ifndef NDEBUG |
| 29 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; | 31 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; |
| 30 #endif | 32 #endif |
| 31 | 33 |
| 34 private: |
| 32 const IntSize m_currentOffset; | 35 const IntSize m_currentOffset; |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 class PLATFORM_EXPORT EndScrollDisplayItem final : public PairedEndDisplayItem { | 38 class PLATFORM_EXPORT EndScrollDisplayItem final : public PairedEndDisplayItem { |
| 36 public: | 39 public: |
| 37 EndScrollDisplayItem(const DisplayItemClientWrapper& client, Type type) | 40 EndScrollDisplayItem(const DisplayItemClientWrapper& client, Type type) |
| 38 : PairedEndDisplayItem(client, type, sizeof(*this)) | 41 : PairedEndDisplayItem(client, type, sizeof(*this)) |
| 39 { | 42 { |
| 40 ASSERT(isEndScrollType(type)); | 43 ASSERT(isEndScrollType(type)); |
| 41 } | 44 } |
| 42 | 45 |
| 43 void replay(GraphicsContext&) override; | 46 void replay(GraphicsContext&) override; |
| 44 void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 47 void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 #if ENABLE(ASSERT) | 50 #if ENABLE(ASSERT) |
| 48 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isScrollType(otherType); } | 51 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isScrollType(otherType); } |
| 49 #endif | 52 #endif |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 } // namespace blink | 55 } // namespace blink |
| 53 | 56 |
| 54 #endif // ScrollDisplayItem_h | 57 #endif // ScrollDisplayItem_h |
| OLD | NEW |