| 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 : public PairedBeginDisplayItem { | 15 class PLATFORM_EXPORT BeginScrollDisplayItem : public PairedBeginDisplayItem { |
| 16 WTF_MAKE_FAST_ALLOCATED(BeginScrollDisplayItem); | |
| 17 public: | 16 public: |
| 18 static PassOwnPtr<BeginScrollDisplayItem> create(const DisplayItemClientWrap
per& client, Type type, const IntSize& currentOffset) | 17 void setNew(IntSize& currentOffset) |
| 19 { | 18 { |
| 20 return adoptPtr(new BeginScrollDisplayItem(client, type, currentOffset))
; | 19 m_currentOffset = currentOffset; |
| 21 } | 20 ASSERT(isScrollType(type())); |
| 22 | |
| 23 BeginScrollDisplayItem(const DisplayItemClientWrapper& client, Type type, co
nst IntSize& currentOffset) | |
| 24 : PairedBeginDisplayItem(client, type) | |
| 25 , m_currentOffset(currentOffset) | |
| 26 { | |
| 27 ASSERT(isScrollType(type)); | |
| 28 } | 21 } |
| 29 | 22 |
| 30 virtual void replay(GraphicsContext&) override; | 23 virtual void replay(GraphicsContext&) override; |
| 31 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 24 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 32 | 25 |
| 33 private: | 26 private: |
| 34 #ifndef NDEBUG | 27 #ifndef NDEBUG |
| 35 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
final; | 28 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
final; |
| 36 #endif | 29 #endif |
| 37 | 30 |
| 38 const IntSize m_currentOffset; | 31 IntSize m_currentOffset; |
| 39 }; | 32 }; |
| 40 | 33 |
| 41 class PLATFORM_EXPORT EndScrollDisplayItem : public PairedEndDisplayItem { | 34 class PLATFORM_EXPORT EndScrollDisplayItem : public PairedEndDisplayItem { |
| 42 WTF_MAKE_FAST_ALLOCATED(EndScrollDisplayItem); | |
| 43 public: | 35 public: |
| 44 static PassOwnPtr<EndScrollDisplayItem> create(const DisplayItemClientWrappe
r& client, Type type) | |
| 45 { | |
| 46 return adoptPtr(new EndScrollDisplayItem(client, type)); | |
| 47 } | |
| 48 | |
| 49 EndScrollDisplayItem(const DisplayItemClientWrapper& client, Type type) | |
| 50 : PairedEndDisplayItem(client, type) | |
| 51 { | |
| 52 ASSERT(isEndScrollType(type)); | |
| 53 } | |
| 54 | |
| 55 virtual void replay(GraphicsContext&) override; | 36 virtual void replay(GraphicsContext&) override; |
| 56 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 37 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 57 | 38 |
| 58 private: | 39 private: |
| 59 #if ENABLE(ASSERT) | 40 #if ENABLE(ASSERT) |
| 60 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isScrollType(otherType); } | 41 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isScrollType(otherType); } |
| 61 #endif | 42 #endif |
| 62 }; | 43 }; |
| 63 | 44 |
| 64 } // namespace blink | 45 } // namespace blink |
| 65 | 46 |
| 66 #endif // ScrollDisplayItem_h | 47 #endif // ScrollDisplayItem_h |
| OLD | NEW |