| 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 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class RoundedRect; | 15 class RoundedRect; |
| 16 | 16 |
| 17 class PLATFORM_EXPORT FloatClipDisplayItem : public PairedBeginDisplayItem { | 17 class PLATFORM_EXPORT FloatClipDisplayItem : public PairedBeginDisplayItem { |
| 18 WTF_MAKE_FAST_ALLOCATED(FloatClipDisplayItem); | |
| 19 public: | 18 public: |
| 20 static PassOwnPtr<FloatClipDisplayItem> create(const DisplayItemClientWrappe
r& client, Type type, const FloatRect& clipRect) | 19 void setNew(FloatRect& clipRect) |
| 21 { | 20 { |
| 22 return adoptPtr(new FloatClipDisplayItem(client, type, clipRect)); | 21 m_clipRect = clipRect; |
| 23 } | 22 ASSERT(isFloatClipType(type())); |
| 24 | |
| 25 FloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type, cons
t FloatRect& clipRect) | |
| 26 : PairedBeginDisplayItem(client, type) | |
| 27 , m_clipRect(clipRect) | |
| 28 { | |
| 29 ASSERT(isFloatClipType(type)); | |
| 30 } | 23 } |
| 31 | 24 |
| 32 virtual void replay(GraphicsContext&) override; | 25 virtual void replay(GraphicsContext&) override; |
| 33 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 26 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 34 | 27 |
| 35 private: | 28 private: |
| 36 #ifndef NDEBUG | 29 #ifndef NDEBUG |
| 37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 30 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
| 38 #endif | 31 #endif |
| 39 | 32 |
| 40 FloatRect m_clipRect; | 33 FloatRect m_clipRect; |
| 41 }; | 34 }; |
| 42 | 35 |
| 43 class PLATFORM_EXPORT EndFloatClipDisplayItem : public PairedEndDisplayItem { | 36 class PLATFORM_EXPORT EndFloatClipDisplayItem : public PairedEndDisplayItem { |
| 44 WTF_MAKE_FAST_ALLOCATED(EndFloatClipDisplayItem); | |
| 45 public: | 37 public: |
| 46 static PassOwnPtr<EndFloatClipDisplayItem> create(const DisplayItemClientWra
pper& client, Type type) | |
| 47 { | |
| 48 return adoptPtr(new EndFloatClipDisplayItem(client, type)); | |
| 49 } | |
| 50 | |
| 51 EndFloatClipDisplayItem(const DisplayItemClientWrapper& client, Type type) | |
| 52 : PairedEndDisplayItem(client, type) | |
| 53 { | |
| 54 ASSERT(isEndFloatClipType(type)); | |
| 55 } | |
| 56 | |
| 57 virtual void replay(GraphicsContext&) override; | 38 virtual void replay(GraphicsContext&) override; |
| 58 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 39 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 59 | 40 |
| 60 private: | 41 private: |
| 61 #if ENABLE(ASSERT) | 42 #if ENABLE(ASSERT) |
| 62 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isFloatClipType(otherType); } | 43 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return DisplayItem::isFloatClipType(otherType); } |
| 63 #endif | 44 #endif |
| 64 }; | 45 }; |
| 65 | 46 |
| 66 } // namespace blink | 47 } // namespace blink |
| 67 | 48 |
| 68 #endif // FloatClipDisplayItem_h | 49 #endif // FloatClipDisplayItem_h |
| OLD | NEW |