Chromium Code Reviews| 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" |
| 11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
| 12 | 12 |
| 13 #ifndef NDEBUG | 13 #ifndef NDEBUG |
| 14 #include "wtf/text/StringBuilder.h" | 14 #include "wtf/text/StringBuilder.h" |
| 15 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 class DisplayItems; | |
| 21 class GraphicsContext; | 22 class GraphicsContext; |
| 22 class WebDisplayItemList; | 23 class WebDisplayItemList; |
| 23 | 24 |
| 24 class PLATFORM_EXPORT DisplayItem { | 25 class PLATFORM_EXPORT DisplayItem { |
| 25 public: | 26 public: |
| 26 enum { | 27 enum { |
| 27 // Must be kept in sync with core/layout/PaintPhase.h. | 28 // Must be kept in sync with core/layout/PaintPhase.h. |
| 28 PaintPhaseMax = 12, | 29 PaintPhaseMax = 12, |
| 29 }; | 30 }; |
| 30 | 31 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 { | 227 { |
| 227 m_scopeId = scopeId; | 228 m_scopeId = scopeId; |
| 228 m_scopeContainer = scopeContainer; | 229 m_scopeContainer = scopeContainer; |
| 229 } | 230 } |
| 230 | 231 |
| 231 // For DisplayItemList only. Painters should use DisplayItemCacheSkipper ins tead. | 232 // For DisplayItemList only. Painters should use DisplayItemCacheSkipper ins tead. |
| 232 void setSkippedCache() { m_skippedCache = true; } | 233 void setSkippedCache() { m_skippedCache = true; } |
| 233 bool skippedCache() const { return m_skippedCache; } | 234 bool skippedCache() const { return m_skippedCache; } |
| 234 | 235 |
| 235 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } | 236 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } |
| 237 virtual void appendByMoving(DisplayItems&) = 0; | |
| 236 | 238 |
| 237 // See comments of enum Type for usage of the following macros. | 239 // See comments of enum Type for usage of the following macros. |
| 238 #define DEFINE_CATEGORY_METHODS(Category) \ | 240 #define DEFINE_CATEGORY_METHODS(Category) \ |
| 239 static bool is##Category##Type(Type type) { return type >= Category##First & & type <= Category##Last; } \ | 241 static bool is##Category##Type(Type type) { return type >= Category##First & & type <= Category##Last; } \ |
| 240 bool is##Category() const { return is##Category##Type(type()); } | 242 bool is##Category() const { return is##Category##Type(type()); } |
| 241 | 243 |
| 242 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ | 244 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ |
| 243 static Type category1##TypeTo##Category2##Type(Type type) \ | 245 static Type category1##TypeTo##Category2##Type(Type type) \ |
| 244 { \ | 246 { \ |
| 245 static_assert(Category1##Last - Category1##First == Category2##Last - Ca tegory2##First, \ | 247 static_assert(Category1##Last - Category1##First == Category2##Last - Ca tegory2##First, \ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di splayItem(client, type) { } | 350 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di splayItem(client, type) { } |
| 349 | 351 |
| 350 #if ENABLE(ASSERT) | 352 #if ENABLE(ASSERT) |
| 351 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; | 353 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; |
| 352 #endif | 354 #endif |
| 353 | 355 |
| 354 private: | 356 private: |
| 355 virtual bool isEnd() const override final { return true; } | 357 virtual bool isEnd() const override final { return true; } |
| 356 }; | 358 }; |
| 357 | 359 |
| 360 // Allows a DisplayItemClientWrapper to be constructed from a DisplayItem, in | |
| 361 // order to facilitate copying it. | |
| 362 // TODO(jbroman): This is a bad class name. | |
| 363 class DisplayItemClientWrapperHelper { | |
|
Xianzhu
2015/06/19 16:19:11
I think we can just use DisplayItemClientWrapper i
| |
| 364 DISALLOW_ALLOCATION(); | |
| 365 public: | |
| 366 DisplayItemClientWrapperHelper(const DisplayItem& wrapped) : m_wrapped(wrapp ed) { } | |
| 367 DisplayItemClient displayItemClient() const { return m_wrapped.client(); } | |
| 368 String debugName() const | |
| 369 { | |
| 370 #ifndef NDEBUG | |
| 371 return m_wrapped.clientDebugString(); | |
| 372 #else | |
| 373 return String(); | |
| 374 #endif | |
| 375 } | |
| 376 private: | |
| 377 const DisplayItem& m_wrapped; | |
| 378 }; | |
| 379 | |
| 380 | |
| 358 } // namespace blink | 381 } // namespace blink |
| 359 | 382 |
| 360 #endif // DisplayItem_h | 383 #endif // DisplayItem_h |
| OLD | NEW |