| 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 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef ClipRect_h | 26 #ifndef ClipRect_h |
| 27 #define ClipRect_h | 27 #define ClipRect_h |
| 28 | 28 |
| 29 #include "platform/geometry/LayoutRect.h" | 29 #include "platform/geometry/LayoutRect.h" |
| 30 #include "wtf/FastAllocBase.h" | 30 #include "wtf/FastAllocBase.h" |
| 31 #include "wtf/PassOwnPtr.h" | |
| 32 | 31 |
| 33 namespace blink { | 32 namespace blink { |
| 34 | 33 |
| 35 class DeprecatedPaintLayer; | |
| 36 class HitTestLocation; | 34 class HitTestLocation; |
| 37 | 35 |
| 38 class ClipRect { | 36 class ClipRect { |
| 39 WTF_MAKE_FAST_ALLOCATED(ClipRect); | 37 WTF_MAKE_FAST_ALLOCATED(ClipRect); |
| 40 public: | 38 public: |
| 41 static PassOwnPtr<ClipRect> create(const ClipRect& other) | |
| 42 { | |
| 43 return adoptPtr(new ClipRect(other)); | |
| 44 } | |
| 45 | |
| 46 ClipRect() | 39 ClipRect() |
| 47 : m_hasRadius(false) | 40 : m_hasRadius(false) |
| 48 { } | 41 { } |
| 49 | 42 |
| 50 ClipRect(const LayoutRect& rect) | 43 ClipRect(const LayoutRect& rect) |
| 51 : m_rect(rect) | 44 : m_rect(rect) |
| 52 , m_hasRadius(false) | 45 , m_hasRadius(false) |
| 53 { } | 46 { } |
| 54 | 47 |
| 55 const LayoutRect& rect() const { return m_rect; } | 48 const LayoutRect& rect() const { return m_rect; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 if (other.hasRadius()) | 61 if (other.hasRadius()) |
| 69 m_hasRadius = true; | 62 m_hasRadius = true; |
| 70 } | 63 } |
| 71 void move(const LayoutSize& size) { m_rect.move(size); } | 64 void move(const LayoutSize& size) { m_rect.move(size); } |
| 72 void move(const IntSize& size) { m_rect.move(size); } | 65 void move(const IntSize& size) { m_rect.move(size); } |
| 73 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } | 66 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } |
| 74 | 67 |
| 75 bool isEmpty() const { return m_rect.isEmpty(); } | 68 bool isEmpty() const { return m_rect.isEmpty(); } |
| 76 bool intersects(const HitTestLocation&) const; | 69 bool intersects(const HitTestLocation&) const; |
| 77 | 70 |
| 78 const DeprecatedPaintLayer* rootLayer() const | |
| 79 { | |
| 80 return m_rootLayer; | |
| 81 } | |
| 82 | |
| 83 void setRootLayer(const DeprecatedPaintLayer* rootLayer) | |
| 84 { | |
| 85 m_rootLayer = rootLayer; | |
| 86 } | |
| 87 | |
| 88 private: | 71 private: |
| 89 const DeprecatedPaintLayer* m_rootLayer; | |
| 90 LayoutRect m_rect; | 72 LayoutRect m_rect; |
| 91 bool m_hasRadius; | 73 bool m_hasRadius; |
| 92 }; | 74 }; |
| 93 | 75 |
| 94 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) | 76 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) |
| 95 { | 77 { |
| 96 ClipRect c = a; | 78 ClipRect c = a; |
| 97 c.intersect(b); | 79 c.intersect(b); |
| 98 return c; | 80 return c; |
| 99 } | 81 } |
| 100 | 82 |
| 101 } // namespace blink | 83 } // namespace blink |
| 102 | 84 |
| 103 #endif // ClipRect_h | 85 #endif // ClipRect_h |
| OLD | NEW |