| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool hasRadius() const { return m_hasRadius; } | 37 bool hasRadius() const { return m_hasRadius; } |
| 38 void setHasRadius(bool hasRadius) { | 38 void setHasRadius() { |
| 39 m_hasRadius = hasRadius; | 39 m_hasRadius = true; |
| 40 m_isInfinite = false; | 40 m_isInfinite = false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void setRect(const FloatRect& rect) { | 43 void setRect(const FloatRect& rect) { |
| 44 m_rect = rect; | 44 m_rect = rect; |
| 45 m_isInfinite = false; | 45 m_isInfinite = false; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void moveBy(const FloatPoint& offset) { |
| 49 if (m_isInfinite) |
| 50 return; |
| 51 m_rect.moveBy(offset); |
| 52 } |
| 53 |
| 48 bool isInfinite() const { return m_isInfinite; } | 54 bool isInfinite() const { return m_isInfinite; } |
| 49 | 55 |
| 50 private: | 56 private: |
| 51 FloatRect m_rect; | 57 FloatRect m_rect; |
| 52 bool m_hasRadius : 1; | 58 bool m_hasRadius : 1; |
| 53 bool m_isInfinite : 1; | 59 bool m_isInfinite : 1; |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 inline bool operator==(const FloatClipRect& a, const FloatClipRect& b) { | 62 inline bool operator==(const FloatClipRect& a, const FloatClipRect& b) { |
| 57 if (a.isInfinite() && b.isInfinite()) | 63 if (a.isInfinite() && b.isInfinite()) |
| 58 return true; | 64 return true; |
| 59 if (!a.isInfinite() && !b.isInfinite()) | 65 if (!a.isInfinite() && !b.isInfinite()) |
| 60 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius(); | 66 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius(); |
| 61 return false; | 67 return false; |
| 62 } | 68 } |
| 63 | 69 |
| 64 } // namespace blink | 70 } // namespace blink |
| 65 | 71 |
| 66 #endif // FloatClipRect_h | 72 #endif // FloatClipRect_h |
| OLD | NEW |