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 PairedBeginDisplayItem { | 17 class PLATFORM_EXPORT FloatClipDisplayItem : public PairedBeginDisplayItem { |
18 WTF_MAKE_FAST_ALLOCATED(FloatClipDisplayItem); | |
19 public: | 18 public: |
20 static PassOwnPtr<FloatClipDisplayItem> create(const DisplayItemClientWrappe
r& client, Type type, const FloatRect& clipRect) | |
21 { | |
22 return adoptPtr(new FloatClipDisplayItem(client, type, clipRect)); | |
23 } | |
24 | |
25 FloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type, cons
t FloatRect& clipRect) | 19 FloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type, cons
t FloatRect& clipRect) |
26 : PairedBeginDisplayItem(client, type) | 20 : PairedBeginDisplayItem(client, type) |
27 , m_clipRect(clipRect) | 21 , m_clipRect(clipRect) |
28 { | 22 { |
29 ASSERT(isFloatClipType(type)); | 23 ASSERT(isFloatClipType(type)); |
30 } | 24 } |
31 | 25 |
32 virtual void replay(GraphicsContext&) override; | 26 virtual void replay(GraphicsContext&) override; |
33 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 27 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
34 | 28 |
35 private: | 29 private: |
36 #ifndef NDEBUG | 30 #ifndef NDEBUG |
37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 31 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
38 #endif | 32 #endif |
39 | 33 |
40 FloatRect m_clipRect; | 34 const FloatRect m_clipRect; |
41 }; | 35 }; |
42 | 36 |
43 class PLATFORM_EXPORT EndFloatClipDisplayItem : public PairedEndDisplayItem { | 37 class PLATFORM_EXPORT EndFloatClipDisplayItem : public PairedEndDisplayItem { |
44 WTF_MAKE_FAST_ALLOCATED(EndFloatClipDisplayItem); | |
45 public: | 38 public: |
46 static PassOwnPtr<EndFloatClipDisplayItem> create(const DisplayItemClientWra
pper& client, Type type) | |
47 { | |
48 return adoptPtr(new EndFloatClipDisplayItem(client, type)); | |
49 } | |
50 | |
51 EndFloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type) | 39 EndFloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type) |
52 : PairedEndDisplayItem(client, type) | 40 : PairedEndDisplayItem(client, type) |
53 { | 41 { |
54 ASSERT(isEndFloatClipType(type)); | 42 ASSERT(isEndFloatClipType(type)); |
55 } | 43 } |
56 | 44 |
57 virtual void replay(GraphicsContext&) override; | 45 virtual void replay(GraphicsContext&) override; |
58 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 46 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
59 | 47 |
60 private: | 48 private: |
61 #if ENABLE(ASSERT) | 49 #if ENABLE(ASSERT) |
62 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isFloatClipType(otherType); } | 50 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isFloatClipType(otherType); } |
63 #endif | 51 #endif |
64 }; | 52 }; |
65 | 53 |
66 } // namespace blink | 54 } // namespace blink |
67 | 55 |
68 #endif // FloatClipDisplayItem_h | 56 #endif // FloatClipDisplayItem_h |
OLD | NEW |