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