Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h |
| index d5f344e605f4b55ad17dfdc5ccdad84f39636a49..76930d7c903e1b9020bfe681b9fea89736911a9c 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h |
| @@ -20,7 +20,7 @@ |
| namespace blink { |
| class GraphicsContext; |
| -class IntRect; |
| +class LayoutSize; |
| class WebDisplayItemList; |
| class PLATFORM_EXPORT DisplayItem { |
| @@ -199,6 +199,7 @@ class PLATFORM_EXPORT DisplayItem { |
| DisplayItem(const DisplayItemClient& client, Type type, size_t derived_size) |
| : client_(&client), |
| + visual_rect_(client.VisualRect()), |
|
Xianzhu
2017/05/19 00:27:42
For now save visual rect for all display items bec
|
| type_(type), |
| derived_size_(derived_size), |
| skipped_cache_(false) |
| @@ -233,6 +234,9 @@ class PLATFORM_EXPORT DisplayItem { |
| DCHECK(client_); |
| return *client_; |
| } |
| + |
| + const LayoutRect& VisualRect() const { return visual_rect_; } |
| + |
| Type GetType() const { return type_; } |
| // Size of this object in memory, used to move it with memcpy. |
| @@ -246,9 +250,7 @@ class PLATFORM_EXPORT DisplayItem { |
| void SetSkippedCache() { skipped_cache_ = true; } |
| bool SkippedCache() const { return skipped_cache_; } |
| - // TODO(wkorman): Only DrawingDisplayItem needs the visual rect argument. |
| - // Consider refactoring class hierarchy to make this more explicit. |
| - virtual void AppendToWebDisplayItemList(const IntRect&, |
| + virtual void AppendToWebDisplayItemList(const LayoutSize&, |
| WebDisplayItemList*) const {} |
| // See comments of enum Type for usage of the following macros. |
| @@ -351,6 +353,7 @@ class PLATFORM_EXPORT DisplayItem { |
| // constructed at the source location. |
| template <typename T, unsigned alignment> |
| friend class ContiguousContainer; |
| + friend class DisplayItemList; |
| DisplayItem() |
| : client_(nullptr), |
| @@ -359,6 +362,8 @@ class PLATFORM_EXPORT DisplayItem { |
| skipped_cache_(false) {} |
| const DisplayItemClient* client_; |
| + LayoutRect visual_rect_; |
| + |
| static_assert(kTypeLast < (1 << 16), |
| "DisplayItem::Type should fit in 16 bits"); |
| const Type type_ : 16; |