| 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 FloatClipDisplayItem_h | 5 #ifndef FloatClipDisplayItem_h |
| 6 #define FloatClipDisplayItem_h | 6 #define FloatClipDisplayItem_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/geometry/FloatRect.h" | 9 #include "platform/geometry/FloatRect.h" |
| 10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class PLATFORM_EXPORT FloatClipDisplayItem final | 14 class PLATFORM_EXPORT FloatClipDisplayItem final |
| 15 : public PairedBeginDisplayItem { | 15 : public PairedBeginDisplayItem { |
| 16 public: | 16 public: |
| 17 FloatClipDisplayItem(const DisplayItemClient& client, | 17 FloatClipDisplayItem(const DisplayItemClient& client, |
| 18 Type type, | 18 Type type, |
| 19 const FloatRect& clip_rect) | 19 const FloatRect& clip_rect) |
| 20 : PairedBeginDisplayItem(client, type, sizeof(*this)), | 20 : PairedBeginDisplayItem(client, type, sizeof(*this)), |
| 21 clip_rect_(clip_rect) { | 21 clip_rect_(clip_rect) { |
| 22 ASSERT(IsFloatClipType(type)); | 22 DCHECK(IsFloatClipType(type)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void Replay(GraphicsContext&) const override; | 25 void Replay(GraphicsContext&) const override; |
| 26 void AppendToWebDisplayItemList(const IntRect&, | 26 void AppendToWebDisplayItemList(const IntRect&, |
| 27 WebDisplayItemList*) const override; | 27 WebDisplayItemList*) const override; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 #ifndef NDEBUG | 30 #ifndef NDEBUG |
| 31 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 31 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
| 32 #endif | 32 #endif |
| 33 bool Equals(const DisplayItem& other) const final { | 33 bool Equals(const DisplayItem& other) const final { |
| 34 return DisplayItem::Equals(other) && | 34 return DisplayItem::Equals(other) && |
| 35 clip_rect_ == | 35 clip_rect_ == |
| 36 static_cast<const FloatClipDisplayItem&>(other).clip_rect_; | 36 static_cast<const FloatClipDisplayItem&>(other).clip_rect_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 const FloatRect clip_rect_; | 39 const FloatRect clip_rect_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class PLATFORM_EXPORT EndFloatClipDisplayItem final | 42 class PLATFORM_EXPORT EndFloatClipDisplayItem final |
| 43 : public PairedEndDisplayItem { | 43 : public PairedEndDisplayItem { |
| 44 public: | 44 public: |
| 45 EndFloatClipDisplayItem(const DisplayItemClient& client, Type type) | 45 EndFloatClipDisplayItem(const DisplayItemClient& client, Type type) |
| 46 : PairedEndDisplayItem(client, type, sizeof(*this)) { | 46 : PairedEndDisplayItem(client, type, sizeof(*this)) { |
| 47 ASSERT(IsEndFloatClipType(type)); | 47 DCHECK(IsEndFloatClipType(type)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Replay(GraphicsContext&) const override; | 50 void Replay(GraphicsContext&) const override; |
| 51 void AppendToWebDisplayItemList(const IntRect&, | 51 void AppendToWebDisplayItemList(const IntRect&, |
| 52 WebDisplayItemList*) const override; | 52 WebDisplayItemList*) const override; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 #if DCHECK_IS_ON() | 55 #if DCHECK_IS_ON() |
| 56 bool IsEndAndPairedWith(DisplayItem::Type other_type) const final { | 56 bool IsEndAndPairedWith(DisplayItem::Type other_type) const final { |
| 57 return DisplayItem::IsFloatClipType(other_type); | 57 return DisplayItem::IsFloatClipType(other_type); |
| 58 } | 58 } |
| 59 #endif | 59 #endif |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| 63 | 63 |
| 64 #endif // FloatClipDisplayItem_h | 64 #endif // FloatClipDisplayItem_h |
| OLD | NEW |