OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DisplayItem_h | |
6 #define DisplayItem_h | |
7 | |
8 #include "platform/PlatformExport.h" | |
9 | |
10 #ifndef NDEBUG | |
11 #include "wtf/text/WTFString.h" | |
12 #endif | |
13 | |
14 namespace blink { | |
15 | |
16 class GraphicsContext; | |
17 | |
18 typedef void* DisplayItemClient; | |
19 | |
20 class PLATFORM_EXPORT DisplayItem { | |
21 public: | |
22 enum Type { | |
23 // DisplayItem types must be kept in sync with PaintPhase. | |
24 DrawingPaintPhaseBlockBackground = 0, | |
25 DrawingPaintPhaseChildBlockBackground = 1, | |
26 DrawingPaintPhaseChildBlockBackgrounds = 2, | |
27 DrawingPaintPhaseFloat = 3, | |
28 DrawingPaintPhaseForeground = 4, | |
29 DrawingPaintPhaseOutline = 5, | |
30 DrawingPaintPhaseChildOutlines = 6, | |
31 DrawingPaintPhaseSelfOutline = 7, | |
32 DrawingPaintPhaseSelection = 8, | |
33 DrawingPaintPhaseCollapsedTableBorders = 9, | |
34 DrawingPaintPhaseTextClip = 10, | |
35 DrawingPaintPhaseMask = 11, | |
36 DrawingPaintPhaseClippingMask = 12, | |
37 ClipLayerOverflowControls = 13, | |
38 ClipLayerBackground = 14, | |
39 ClipLayerParent = 15, | |
40 ClipLayerFilter = 16, | |
41 ClipLayerForeground = 17, | |
42 ClipLayerFragmentFloat = 18, | |
43 ClipLayerFragmentForeground = 19, | |
44 ClipLayerFragmentChildOutline = 20, | |
45 ClipLayerFragmentOutline = 21, | |
46 ClipLayerFragmentMask = 22, | |
47 ClipLayerFragmentClippingMask = 23, | |
48 ClipLayerFragmentParent = 24, | |
49 ClipLayerFragmentSelection = 25, | |
50 ClipLayerFragmentChildBlockBackgrounds = 26, | |
51 EndClip = 27, | |
52 }; | |
53 | |
54 virtual ~DisplayItem() { } | |
55 | |
56 virtual void replay(GraphicsContext*) = 0; | |
57 | |
58 DisplayItemClient client() const { return m_id.client; } | |
59 Type type() const { return m_id.type; } | |
60 bool idsEqual(const DisplayItem& other) const { return m_id.client == other.
m_id.client && m_id.type == other.m_id.type; } | |
61 | |
62 #ifndef NDEBUG | |
63 static WTF::String typeAsDebugString(DisplayItem::Type); | |
64 | |
65 void setClientDebugString(const WTF::String& clientDebugString) { m_clientDe
bugString = clientDebugString; } | |
66 const WTF::String& clientDebugString() const { return m_clientDebugString; } | |
67 | |
68 virtual WTF::String asDebugString() const; | |
69 #endif | |
70 | |
71 protected: | |
72 DisplayItem(DisplayItemClient client, Type type) | |
73 : m_id(client, type) | |
74 { } | |
75 | |
76 private: | |
77 struct Id { | |
78 Id(DisplayItemClient c, Type t) | |
79 : client(c) | |
80 , type(t) | |
81 { } | |
82 | |
83 const DisplayItemClient client; | |
84 const Type type; | |
85 } m_id; | |
86 #ifndef NDEBUG | |
87 WTF::String m_clientDebugString; | |
88 #endif | |
89 }; | |
90 | |
91 } | |
92 | |
93 #endif // DisplayItem_h | |
OLD | NEW |