| 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 FakeDisplayItemClient_h | 5 #ifndef FakeDisplayItemClient_h |
| 6 #define FakeDisplayItemClient_h | 6 #define FakeDisplayItemClient_h |
| 7 | 7 |
| 8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 9 #include "wtf/Forward.h" | 9 #include "platform/wtf/Forward.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // A simple DisplayItemClient implementation suitable for use in unit tests. | 13 // A simple DisplayItemClient implementation suitable for use in unit tests. |
| 14 class FakeDisplayItemClient : public DisplayItemClient { | 14 class FakeDisplayItemClient : public DisplayItemClient { |
| 15 public: | 15 public: |
| 16 FakeDisplayItemClient(const String& name = "FakeDisplayItemClient", | 16 FakeDisplayItemClient(const String& name = "FakeDisplayItemClient", |
| 17 const LayoutRect& visualRect = LayoutRect()) | 17 const LayoutRect& visualRect = LayoutRect()) |
| 18 : m_name(name), m_visualRect(visualRect) {} | 18 : m_name(name), m_visualRect(visualRect) {} |
| 19 | 19 |
| 20 String debugName() const final { return m_name; } | 20 String debugName() const final { return m_name; } |
| 21 LayoutRect visualRect() const override { return m_visualRect; } | 21 LayoutRect visualRect() const override { return m_visualRect; } |
| 22 | 22 |
| 23 void setVisualRect(const LayoutRect& r) { m_visualRect = r; } | 23 void setVisualRect(const LayoutRect& r) { m_visualRect = r; } |
| 24 | 24 |
| 25 // This simulates a paint without needing a PaintController. | 25 // This simulates a paint without needing a PaintController. |
| 26 void updateCacheGeneration() { | 26 void updateCacheGeneration() { |
| 27 setDisplayItemsCached(CacheGenerationOrInvalidationReason::next()); | 27 setDisplayItemsCached(CacheGenerationOrInvalidationReason::next()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 String m_name; | 31 String m_name; |
| 32 LayoutRect m_visualRect; | 32 LayoutRect m_visualRect; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace blink | 35 } // namespace blink |
| 36 | 36 |
| 37 #endif // FakeDisplayItemClient_h | 37 #endif // FakeDisplayItemClient_h |
| OLD | NEW |