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 "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", const La
youtRect& visualRect = LayoutRect()) | 16 FakeDisplayItemClient(const String& name = "FakeDisplayItemClient", const La
youtRect& visualRect = LayoutRect()) |
17 : m_name(name), m_visualRect(visualRect) | 17 : m_name(name), m_visualRect(visualRect) |
18 { } | 18 { } |
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; } |
| 24 |
23 // This simulates a paint without needing a PaintController. | 25 // This simulates a paint without needing a PaintController. |
24 void updateCacheGeneration() | 26 void updateCacheGeneration() |
25 { | 27 { |
26 setDisplayItemsCached(CacheGenerationOrInvalidationReason::next()); | 28 setDisplayItemsCached(CacheGenerationOrInvalidationReason::next()); |
27 } | 29 } |
28 | 30 |
29 private: | 31 private: |
30 String m_name; | 32 String m_name; |
31 LayoutRect m_visualRect; | 33 LayoutRect m_visualRect; |
32 }; | 34 }; |
33 | 35 |
34 } // namespace blink | 36 } // namespace blink |
35 | 37 |
36 #endif // FakeDisplayItemClient_h | 38 #endif // FakeDisplayItemClient_h |
OLD | NEW |