| 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 "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, | 173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, |
| 174 EndSubtreeLast = EndSubtreePaintPhaseLast, | 174 EndSubtreeLast = EndSubtreePaintPhaseLast, |
| 175 | 175 |
| 176 TypeLast = EndSubtreeLast | 176 TypeLast = EndSubtreeLast |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 virtual ~DisplayItem() { } | 179 virtual ~DisplayItem() { } |
| 180 | 180 |
| 181 virtual void replay(GraphicsContext&) { } | 181 virtual void replay(GraphicsContext&) { } |
| 182 | 182 |
| 183 DisplayItemClient client() const { return m_id.client; } | 183 DisplayItemClient client() const { return m_client; } |
| 184 Type type() const { return m_id.type; } | 184 Type type() const { return m_type; } |
| 185 bool idsEqual(const DisplayItem& other, Type overrideType) const | 185 bool idsEqual(const DisplayItem& other, Type overrideType) const |
| 186 { | 186 { |
| 187 return m_id.client == other.m_id.client | 187 return m_client == other.m_client |
| 188 && m_id.type == overrideType | 188 && m_type == overrideType |
| 189 && m_id.scopeId == other.m_id.scopeId | 189 && m_scopeId == other.m_scopeId |
| 190 && m_id.scopeContainer == other.m_id.scopeContainer; | 190 && m_scopeContainer == other.m_scopeContainer; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void setScope(int scopeId, DisplayItemClient scopeContainer) | 193 void setScope(int scopeId, DisplayItemClient scopeContainer) |
| 194 { | 194 { |
| 195 m_id.scopeId = scopeId; | 195 m_scopeId = scopeId; |
| 196 m_id.scopeContainer = scopeContainer; | 196 m_scopeContainer = scopeContainer; |
| 197 } | 197 } |
| 198 | 198 |
| 199 // For DisplayItemList only. Painters should use DisplayItemCacheSkipper ins
tead. |
| 200 void setSkippedCache() { m_skippedCache = true; } |
| 201 bool skippedCache() const { return m_skippedCache; } |
| 202 |
| 199 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } | 203 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } |
| 200 | 204 |
| 201 // See comments of enum Type for usage of the following macros. | 205 // See comments of enum Type for usage of the following macros. |
| 202 #define DEFINE_CATEGORY_METHODS(Category) \ | 206 #define DEFINE_CATEGORY_METHODS(Category) \ |
| 203 static bool is##Category##Type(Type type) { return type >= Category##First &
& type <= Category##Last; } \ | 207 static bool is##Category##Type(Type type) { return type >= Category##First &
& type <= Category##Last; } \ |
| 204 bool is##Category() const { return is##Category##Type(type()); } | 208 bool is##Category() const { return is##Category##Type(type()); } |
| 205 | 209 |
| 206 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ | 210 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ |
| 207 static Type category1##TypeTo##Category2##Type(Type type) \ | 211 static Type category1##TypeTo##Category2##Type(Type type) \ |
| 208 { \ | 212 { \ |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 273 |
| 270 #ifndef NDEBUG | 274 #ifndef NDEBUG |
| 271 static WTF::String typeAsDebugString(DisplayItem::Type); | 275 static WTF::String typeAsDebugString(DisplayItem::Type); |
| 272 const WTF::String& clientDebugString() const { return m_clientDebugString; } | 276 const WTF::String& clientDebugString() const { return m_clientDebugString; } |
| 273 WTF::String asDebugString() const; | 277 WTF::String asDebugString() const; |
| 274 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; | 278 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; |
| 275 #endif | 279 #endif |
| 276 | 280 |
| 277 protected: | 281 protected: |
| 278 DisplayItem(const DisplayItemClientWrapper& client, Type type) | 282 DisplayItem(const DisplayItemClientWrapper& client, Type type) |
| 279 : m_id(client.displayItemClient(), type) | 283 : m_client(client.displayItemClient()) |
| 284 , m_scopeContainer(nullptr) |
| 285 , m_scopeId(0) |
| 286 , m_type(type) |
| 287 , m_skippedCache(false) |
| 280 #ifndef NDEBUG | 288 #ifndef NDEBUG |
| 281 , m_clientDebugString(client.debugName()) | 289 , m_clientDebugString(client.debugName()) |
| 282 #endif | 290 #endif |
| 283 { } | 291 { } |
| 284 | 292 |
| 285 private: | 293 private: |
| 286 struct Id { | 294 const DisplayItemClient m_client; |
| 287 Id(DisplayItemClient c, Type t) : client(c), type(t), scopeId(0), scopeC
ontainer(nullptr) | 295 DisplayItemClient m_scopeContainer; |
| 288 { | 296 int m_scopeId; |
| 289 ASSERT(c); | 297 static_assert(TypeLast < (1 << 16), "DisplayItem::Type should fit in 16 bits
"); |
| 290 } | 298 const Type m_type : 16; |
| 291 | 299 unsigned m_skippedCache : 1; |
| 292 const DisplayItemClient client; | |
| 293 const Type type; | |
| 294 int scopeId; | |
| 295 DisplayItemClient scopeContainer; | |
| 296 } m_id; | |
| 297 | 300 |
| 298 #ifndef NDEBUG | 301 #ifndef NDEBUG |
| 299 WTF::String m_clientDebugString; | 302 WTF::String m_clientDebugString; |
| 300 #endif | 303 #endif |
| 301 }; | 304 }; |
| 302 | 305 |
| 303 class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem { | 306 class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem { |
| 304 protected: | 307 protected: |
| 305 PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type) :
DisplayItem(client, type) { } | 308 PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type) :
DisplayItem(client, type) { } |
| 306 | 309 |
| 307 private: | 310 private: |
| 308 virtual bool isBegin() const override final { return true; } | 311 virtual bool isBegin() const override final { return true; } |
| 309 }; | 312 }; |
| 310 | 313 |
| 311 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem { | 314 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem { |
| 312 protected: | 315 protected: |
| 313 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di
splayItem(client, type) { } | 316 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di
splayItem(client, type) { } |
| 314 | 317 |
| 315 #if ENABLE(ASSERT) | 318 #if ENABLE(ASSERT) |
| 316 virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0
; | 319 virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0
; |
| 317 #endif | 320 #endif |
| 318 | 321 |
| 319 private: | 322 private: |
| 320 virtual bool isEnd() const override final { return true; } | 323 virtual bool isEnd() const override final { return true; } |
| 321 }; | 324 }; |
| 322 | 325 |
| 323 } // namespace blink | 326 } // namespace blink |
| 324 | 327 |
| 325 #endif // DisplayItem_h | 328 #endif // DisplayItem_h |
| OLD | NEW |