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 FloatClipDisplayItem_h | 5 #ifndef FloatClipDisplayItem_h |
6 #define FloatClipDisplayItem_h | 6 #define FloatClipDisplayItem_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/geometry/FloatRect.h" | 9 #include "platform/geometry/FloatRect.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class RoundedRect; | 15 class RoundedRect; |
16 | 16 |
17 class PLATFORM_EXPORT FloatClipDisplayItem : public DisplayItem { | 17 class PLATFORM_EXPORT FloatClipDisplayItem : public PairedBeginDisplayItem { |
18 WTF_MAKE_FAST_ALLOCATED; | 18 WTF_MAKE_FAST_ALLOCATED; |
19 public: | 19 public: |
20 static PassOwnPtr<FloatClipDisplayItem> create(DisplayItemClient client, Typ
e type, const FloatRect& clipRect) | 20 static PassOwnPtr<FloatClipDisplayItem> create(DisplayItemClient client, Typ
e type, const FloatRect& clipRect) |
21 { | 21 { |
22 return adoptPtr(new FloatClipDisplayItem(client, type, clipRect)); | 22 return adoptPtr(new FloatClipDisplayItem(client, type, clipRect)); |
23 } | 23 } |
24 | 24 |
25 FloatClipDisplayItem(DisplayItemClient client, Type type, const FloatRect& c
lipRect) | 25 FloatClipDisplayItem(DisplayItemClient client, Type type, const FloatRect& c
lipRect) |
26 : DisplayItem(client, type) | 26 : PairedBeginDisplayItem(client, type) |
27 , m_clipRect(clipRect) | 27 , m_clipRect(clipRect) |
28 { | 28 { |
29 ASSERT(isFloatClipType(type)); | 29 ASSERT(isFloatClipType(type)); |
30 } | 30 } |
31 | 31 |
32 virtual void replay(GraphicsContext*) override; | 32 virtual void replay(GraphicsContext*) override; |
33 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 33 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
34 | 34 |
35 private: | 35 private: |
36 #ifndef NDEBUG | 36 #ifndef NDEBUG |
37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
38 #endif | 38 #endif |
39 | 39 |
40 FloatRect m_clipRect; | 40 FloatRect m_clipRect; |
41 }; | 41 }; |
42 | 42 |
43 class PLATFORM_EXPORT EndFloatClipDisplayItem : public DisplayItem { | 43 class PLATFORM_EXPORT EndFloatClipDisplayItem : public PairedEndDisplayItem { |
44 WTF_MAKE_FAST_ALLOCATED; | 44 WTF_MAKE_FAST_ALLOCATED; |
45 public: | 45 public: |
46 static PassOwnPtr<EndFloatClipDisplayItem> create(DisplayItemClient client,
Type type) | 46 static PassOwnPtr<EndFloatClipDisplayItem> create(DisplayItemClient client,
Type type) |
47 { | 47 { |
48 return adoptPtr(new EndFloatClipDisplayItem(client, type)); | 48 return adoptPtr(new EndFloatClipDisplayItem(client, type)); |
49 } | 49 } |
50 | 50 |
51 EndFloatClipDisplayItem(DisplayItemClient client, Type type) | 51 EndFloatClipDisplayItem(DisplayItemClient client, Type type) |
52 : DisplayItem(client, type) | 52 : PairedEndDisplayItem(client, type) |
53 { | 53 { |
54 ASSERT(isEndFloatClipType(type)); | 54 ASSERT(isEndFloatClipType(type)); |
55 } | 55 } |
56 | 56 |
57 virtual void replay(GraphicsContext*) override; | 57 virtual void replay(GraphicsContext*) override; |
58 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 58 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 59 |
| 60 private: |
| 61 #if ENABLE(ASSERT) |
| 62 virtual bool isEndAndPairedWith(const DisplayItem& other) const override fin
al { return other.isFloatClip(); } |
| 63 #endif |
59 }; | 64 }; |
60 | 65 |
61 } // namespace blink | 66 } // namespace blink |
62 | 67 |
63 #endif // FloatClipDisplayItem_h | 68 #endif // FloatClipDisplayItem_h |
OLD | NEW |