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 DisplayItem { | 15 class PLATFORM_EXPORT BeginScrollDisplayItem : public PairedBeginDisplayItem { |
16 WTF_MAKE_FAST_ALLOCATED; | 16 WTF_MAKE_FAST_ALLOCATED; |
17 public: | 17 public: |
18 static PassOwnPtr<BeginScrollDisplayItem> create(DisplayItemClient client, T
ype type, const IntSize& currentOffset) | 18 static PassOwnPtr<BeginScrollDisplayItem> create(DisplayItemClient client, T
ype type, const IntSize& currentOffset) |
19 { | 19 { |
20 return adoptPtr(new BeginScrollDisplayItem(client, type, currentOffset))
; | 20 return adoptPtr(new BeginScrollDisplayItem(client, type, currentOffset))
; |
21 } | 21 } |
22 | 22 |
23 BeginScrollDisplayItem(DisplayItemClient client, Type type, const IntSize& c
urrentOffset) | 23 BeginScrollDisplayItem(DisplayItemClient client, Type type, const IntSize& c
urrentOffset) |
24 : DisplayItem(client, type) | 24 : PairedBeginDisplayItem(client, type) |
25 , m_currentOffset(currentOffset) { } | 25 , m_currentOffset(currentOffset) |
| 26 { |
| 27 ASSERT(isScrollType(type)); |
| 28 } |
26 | 29 |
27 virtual void replay(GraphicsContext*) override; | 30 virtual void replay(GraphicsContext*) override; |
28 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 31 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
29 | 32 |
30 private: | 33 private: |
31 const IntSize m_currentOffset; | 34 const IntSize m_currentOffset; |
32 }; | 35 }; |
33 | 36 |
34 class PLATFORM_EXPORT EndScrollDisplayItem : public DisplayItem { | 37 class PLATFORM_EXPORT EndScrollDisplayItem : public PairedEndDisplayItem { |
35 WTF_MAKE_FAST_ALLOCATED; | 38 WTF_MAKE_FAST_ALLOCATED; |
36 public: | 39 public: |
37 static PassOwnPtr<EndScrollDisplayItem> create(DisplayItemClient client, Typ
e type) | 40 static PassOwnPtr<EndScrollDisplayItem> create(DisplayItemClient client, Typ
e type) |
38 { | 41 { |
39 return adoptPtr(new EndScrollDisplayItem(client, type)); | 42 return adoptPtr(new EndScrollDisplayItem(client, type)); |
40 } | 43 } |
41 | 44 |
42 EndScrollDisplayItem(DisplayItemClient client, Type type) | 45 EndScrollDisplayItem(DisplayItemClient client, Type type) |
43 : DisplayItem(client, type) { } | 46 : PairedEndDisplayItem(client, type) |
| 47 { |
| 48 ASSERT(isEndScrollType(type)); |
| 49 } |
44 | 50 |
45 virtual void replay(GraphicsContext*) override; | 51 virtual void replay(GraphicsContext*) override; |
46 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 52 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 53 |
| 54 private: |
| 55 #if ENABLE(ASSERT) |
| 56 virtual bool isEndAndPairedWith(const DisplayItem& other) const override fin
al { return other.isScroll(); } |
| 57 #endif |
47 }; | 58 }; |
48 | 59 |
49 } // namespace blink | 60 } // namespace blink |
50 | 61 |
51 #endif // ScrollDisplayItem_h | 62 #endif // ScrollDisplayItem_h |
OLD | NEW |