OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 27 matching lines...) Expand all Loading... |
38 ClipRect() | 38 ClipRect() |
39 : m_hasRadius(false) | 39 : m_hasRadius(false) |
40 { } | 40 { } |
41 | 41 |
42 ClipRect(const LayoutRect& rect) | 42 ClipRect(const LayoutRect& rect) |
43 : m_rect(rect) | 43 : m_rect(rect) |
44 , m_hasRadius(false) | 44 , m_hasRadius(false) |
45 { } | 45 { } |
46 | 46 |
47 const LayoutRect& rect() const { return m_rect; } | 47 const LayoutRect& rect() const { return m_rect; } |
48 void setRect(const LayoutRect& rect) { m_rect = rect; } | |
49 | 48 |
50 bool hasRadius() const { return m_hasRadius; } | 49 bool hasRadius() const { return m_hasRadius; } |
51 void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; } | 50 void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; } |
52 | 51 |
53 bool operator==(const ClipRect& other) const { return rect() == other.rect()
&& hasRadius() == other.hasRadius(); } | 52 bool operator==(const ClipRect& other) const { return rect() == other.rect()
&& hasRadius() == other.hasRadius(); } |
54 bool operator!=(const ClipRect& other) const { return rect() != other.rect()
|| hasRadius() != other.hasRadius(); } | 53 bool operator!=(const ClipRect& other) const { return rect() != other.rect()
|| hasRadius() != other.hasRadius(); } |
55 bool operator!=(const LayoutRect& otherRect) const { return rect() != otherR
ect; } | 54 bool operator!=(const LayoutRect& otherRect) const { return rect() != otherR
ect; } |
56 | 55 |
57 void intersect(const LayoutRect& other) { m_rect.intersect(other); } | 56 void intersect(const LayoutRect& other) { m_rect.intersect(other); } |
58 void intersect(const ClipRect& other) | 57 void intersect(const ClipRect& other) |
59 { | 58 { |
60 m_rect.intersect(other.rect()); | 59 m_rect.intersect(other.rect()); |
61 if (other.hasRadius()) | 60 if (other.hasRadius()) |
62 m_hasRadius = true; | 61 m_hasRadius = true; |
63 } | 62 } |
64 void move(LayoutUnit x, LayoutUnit y) { m_rect.move(x, y); } | |
65 void move(const LayoutSize& size) { m_rect.move(size); } | 63 void move(const LayoutSize& size) { m_rect.move(size); } |
66 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } | 64 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } |
67 | 65 |
68 bool isEmpty() const { return m_rect.isEmpty(); } | 66 bool isEmpty() const { return m_rect.isEmpty(); } |
69 bool intersects(const LayoutRect& rect) const { return m_rect.intersects(rec
t); } | |
70 bool intersects(const HitTestLocation&) const; | 67 bool intersects(const HitTestLocation&) const; |
71 | 68 |
72 private: | 69 private: |
73 LayoutRect m_rect; | 70 LayoutRect m_rect; |
74 bool m_hasRadius; | 71 bool m_hasRadius; |
75 }; | 72 }; |
76 | 73 |
77 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) | 74 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) |
78 { | 75 { |
79 ClipRect c = a; | 76 ClipRect c = a; |
80 c.intersect(b); | 77 c.intersect(b); |
81 return c; | 78 return c; |
82 } | 79 } |
83 | 80 |
84 } // namespace blink | 81 } // namespace blink |
85 | 82 |
86 #endif // ClipRect_h | 83 #endif // ClipRect_h |
OLD | NEW |