OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 FloatClipRect_h | 5 #ifndef FloatClipRect_h |
6 #define FloatClipRect_h | 6 #define FloatClipRect_h |
7 | 7 |
8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class PLATFORM_EXPORT FloatClipRect { | 14 class PLATFORM_EXPORT FloatClipRect { |
15 USING_FAST_MALLOC(FloatClipRect); | 15 USING_FAST_MALLOC(FloatClipRect); |
16 | 16 |
17 public: | 17 public: |
18 FloatClipRect() | 18 FloatClipRect() |
19 : m_rect(FloatRect(LayoutRect::infiniteIntRect())), | 19 : m_rect(FloatRect(LayoutRect::infiniteIntRect())), |
20 m_hasRadius(false), | 20 m_hasRadius(false), |
21 m_isInfinite(true) {} | 21 m_isInfinite(true) {} |
22 | 22 |
23 FloatClipRect(const FloatRect& rect) | 23 explicit FloatClipRect(const FloatRect& rect) |
24 : m_rect(rect), m_hasRadius(false), m_isInfinite(false) {} | 24 : m_rect(rect), m_hasRadius(false), m_isInfinite(false) {} |
25 | 25 |
26 const FloatRect& rect() const { return m_rect; } | 26 const FloatRect& rect() const { return m_rect; } |
27 | 27 |
28 void intersect(const FloatRect& other) { | 28 void intersect(const FloatRect& other) { |
29 if (m_isInfinite) { | 29 if (m_isInfinite) { |
30 m_rect = other; | 30 m_rect = other; |
31 m_isInfinite = false; | 31 m_isInfinite = false; |
32 } else { | 32 } else { |
33 m_rect.intersect(other); | 33 m_rect.intersect(other); |
(...skipping 29 matching lines...) Expand all Loading... |
63 if (a.isInfinite() && b.isInfinite()) | 63 if (a.isInfinite() && b.isInfinite()) |
64 return true; | 64 return true; |
65 if (!a.isInfinite() && !b.isInfinite()) | 65 if (!a.isInfinite() && !b.isInfinite()) |
66 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius(); | 66 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius(); |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 } // namespace blink | 70 } // namespace blink |
71 | 71 |
72 #endif // FloatClipRect_h | 72 #endif // FloatClipRect_h |
OLD | NEW |