| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class HitTestLocation; | 34 class HitTestLocation; |
| 35 | 35 |
| 36 class ClipRect { | 36 class ClipRect { |
| 37 WTF_MAKE_FAST_ALLOCATED(ClipRect); | 37 WTF_MAKE_FAST_ALLOCATED(ClipRect); |
| 38 public: | 38 public: |
| 39 ClipRect() | 39 ClipRect() |
| 40 : m_hasRadius(false) | 40 : m_hasRadius(false) |
| 41 , m_isClippedByClipCss(false) |
| 41 { } | 42 { } |
| 42 | 43 |
| 43 ClipRect(const LayoutRect& rect) | 44 ClipRect(const LayoutRect& rect) |
| 44 : m_rect(rect) | 45 : m_rect(rect) |
| 45 , m_hasRadius(false) | 46 , m_hasRadius(false) |
| 47 , m_isClippedByClipCss(false) |
| 46 { } | 48 { } |
| 47 | 49 |
| 48 const LayoutRect& rect() const { return m_rect; } | 50 const LayoutRect& rect() const { return m_rect; } |
| 49 | 51 |
| 50 bool hasRadius() const { return m_hasRadius; } | 52 bool hasRadius() const { return m_hasRadius; } |
| 51 void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; } | 53 void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; } |
| 52 | 54 |
| 53 bool operator==(const ClipRect& other) const { return rect() == other.rect()
&& hasRadius() == other.hasRadius(); } | 55 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(); } | 56 bool operator!=(const ClipRect& other) const { return rect() != other.rect()
|| hasRadius() != other.hasRadius(); } |
| 55 bool operator!=(const LayoutRect& otherRect) const { return rect() != otherR
ect; } | 57 bool operator!=(const LayoutRect& otherRect) const { return rect() != otherR
ect; } |
| 56 | 58 |
| 57 void intersect(const LayoutRect& other) { m_rect.intersect(other); } | 59 void intersect(const LayoutRect& other) { m_rect.intersect(other); } |
| 58 void intersect(const ClipRect& other) | 60 void intersect(const ClipRect& other) |
| 59 { | 61 { |
| 60 m_rect.intersect(other.rect()); | 62 m_rect.intersect(other.rect()); |
| 61 if (other.hasRadius()) | 63 if (other.hasRadius()) |
| 62 m_hasRadius = true; | 64 m_hasRadius = true; |
| 63 } | 65 } |
| 64 void move(const LayoutSize& size) { m_rect.move(size); } | 66 void move(const LayoutSize& size) { m_rect.move(size); } |
| 65 void move(const IntSize& size) { m_rect.move(size); } | 67 void move(const IntSize& size) { m_rect.move(size); } |
| 66 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } | 68 void moveBy(const LayoutPoint& point) { m_rect.moveBy(point); } |
| 67 | 69 |
| 68 bool isEmpty() const { return m_rect.isEmpty(); } | 70 bool isEmpty() const { return m_rect.isEmpty(); } |
| 69 bool intersects(const HitTestLocation&) const; | 71 bool intersects(const HitTestLocation&) const; |
| 70 | 72 |
| 73 // These have no semantic use. They are used for use-counting. |
| 74 bool isClippedByClipCss() const { return m_isClippedByClipCss; } |
| 75 void setIsClippedByClipCss() { m_isClippedByClipCss = true; } |
| 76 |
| 71 private: | 77 private: |
| 72 LayoutRect m_rect; | 78 LayoutRect m_rect; |
| 73 bool m_hasRadius; | 79 bool m_hasRadius; |
| 80 bool m_isClippedByClipCss; |
| 74 }; | 81 }; |
| 75 | 82 |
| 76 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) | 83 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) |
| 77 { | 84 { |
| 78 ClipRect c = a; | 85 ClipRect c = a; |
| 79 c.intersect(b); | 86 c.intersect(b); |
| 80 return c; | 87 return c; |
| 81 } | 88 } |
| 82 | 89 |
| 83 } // namespace blink | 90 } // namespace blink |
| 84 | 91 |
| 85 #endif // ClipRect_h | 92 #endif // ClipRect_h |
| OLD | NEW |