| 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 DisplayItem_h | 5 #ifndef DisplayItem_h |
| 6 #define DisplayItem_h | 6 #define DisplayItem_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
| 10 #include "wtf/PassOwnPtr.h" |
| 10 | 11 |
| 11 #ifndef NDEBUG | 12 #ifndef NDEBUG |
| 12 #include "wtf/text/StringBuilder.h" | 13 #include "wtf/text/StringBuilder.h" |
| 13 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 class GraphicsContext; | 20 class GraphicsContext; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ClipBoxCollapsedTableBorders, | 68 ClipBoxCollapsedTableBorders, |
| 68 ClipBoxTextClip, | 69 ClipBoxTextClip, |
| 69 ClipBoxClippingMask, | 70 ClipBoxClippingMask, |
| 70 BeginTransform, | 71 BeginTransform, |
| 71 EndTransform, | 72 EndTransform, |
| 72 ScrollbarCorner, | 73 ScrollbarCorner, |
| 73 Scrollbar, | 74 Scrollbar, |
| 74 Resizer | 75 Resizer |
| 75 }; | 76 }; |
| 76 | 77 |
| 78 // Create a dummy display item which just holds the id but has no display op
eration. |
| 79 // It helps a CachedDisplayItem to match the corresponding original empty di
splay item. |
| 80 static PassOwnPtr<DisplayItem> create(DisplayItemClient client, Type type) {
return adoptPtr(new DisplayItem(client, type)); } |
| 81 |
| 77 virtual ~DisplayItem() { } | 82 virtual ~DisplayItem() { } |
| 78 | 83 |
| 79 virtual void replay(GraphicsContext*) = 0; | 84 virtual void replay(GraphicsContext*) { } |
| 80 | 85 |
| 81 DisplayItemClient client() const { return m_id.client; } | 86 DisplayItemClient client() const { return m_id.client; } |
| 82 Type type() const { return m_id.type; } | 87 Type type() const { return m_id.type; } |
| 83 bool idsEqual(const DisplayItem& other) const { return m_id.client == other.
m_id.client && m_id.type == other.m_id.type; } | 88 bool idsEqual(const DisplayItem& other) const { return m_id.client == other.
m_id.client && m_id.type == other.m_id.type; } |
| 84 | 89 |
| 85 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const = 0; | 90 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } |
| 86 | 91 |
| 87 #ifndef NDEBUG | 92 #ifndef NDEBUG |
| 88 static WTF::String typeAsDebugString(DisplayItem::Type); | 93 static WTF::String typeAsDebugString(DisplayItem::Type); |
| 89 | 94 |
| 90 void setClientDebugString(const WTF::String& clientDebugString) { m_clientDe
bugString = clientDebugString; } | 95 void setClientDebugString(const WTF::String& clientDebugString) { m_clientDe
bugString = clientDebugString; } |
| 91 const WTF::String& clientDebugString() const { return m_clientDebugString; } | 96 const WTF::String& clientDebugString() const { return m_clientDebugString; } |
| 92 | 97 |
| 93 WTF::String asDebugString() const; | 98 WTF::String asDebugString() const; |
| 99 virtual const char* name() const { return "Dummy"; } |
| 94 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; | 100 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; |
| 95 #endif | 101 #endif |
| 96 | 102 |
| 97 virtual bool isCached() const { return false; } | 103 virtual bool isCached() const { return false; } |
| 98 | 104 |
| 99 protected: | 105 protected: |
| 100 DisplayItem(DisplayItemClient client, Type type) | 106 DisplayItem(DisplayItemClient client, Type type) |
| 101 : m_id(client, type) | 107 : m_id(client, type) |
| 102 { | 108 { |
| 103 ASSERT(client); | 109 ASSERT(client); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 const Type type; | 122 const Type type; |
| 117 } m_id; | 123 } m_id; |
| 118 #ifndef NDEBUG | 124 #ifndef NDEBUG |
| 119 WTF::String m_clientDebugString; | 125 WTF::String m_clientDebugString; |
| 120 #endif | 126 #endif |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } | 129 } |
| 124 | 130 |
| 125 #endif // DisplayItem_h | 131 #endif // DisplayItem_h |
| OLD | NEW |