| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #ifndef HitTestLocation_h | 22 #ifndef HitTestLocation_h |
| 23 #define HitTestLocation_h | 23 #define HitTestLocation_h |
| 24 | 24 |
| 25 #include "platform/geometry/FloatQuad.h" | 25 #include "platform/geometry/FloatQuad.h" |
| 26 #include "platform/geometry/FloatRect.h" | 26 #include "platform/geometry/FloatRect.h" |
| 27 #include "platform/geometry/LayoutRect.h" | 27 #include "platform/geometry/LayoutRect.h" |
| 28 #include "platform/geometry/RoundedRect.h" | |
| 29 #include "wtf/Forward.h" | 28 #include "wtf/Forward.h" |
| 30 #include "wtf/ListHashSet.h" | 29 #include "wtf/ListHashSet.h" |
| 31 #include "wtf/OwnPtr.h" | 30 #include "wtf/OwnPtr.h" |
| 32 #include "wtf/RefPtr.h" | 31 #include "wtf/RefPtr.h" |
| 33 | 32 |
| 34 namespace blink { | 33 namespace blink { |
| 35 | 34 |
| 35 class FloatRoundedRect; |
| 36 |
| 36 class HitTestLocation { | 37 class HitTestLocation { |
| 37 public: | 38 public: |
| 38 | 39 |
| 39 // Note that all points are in contents (aka "page") coordinate space for th
e | 40 // Note that all points are in contents (aka "page") coordinate space for th
e |
| 40 // document that is being hit tested. | 41 // document that is being hit tested. |
| 41 HitTestLocation(); | 42 HitTestLocation(); |
| 42 HitTestLocation(const LayoutPoint&); | 43 HitTestLocation(const LayoutPoint&); |
| 43 HitTestLocation(const FloatPoint&); | 44 HitTestLocation(const FloatPoint&); |
| 44 HitTestLocation(const FloatPoint&, const FloatQuad&); | 45 HitTestLocation(const FloatPoint&, const FloatQuad&); |
| 45 // Pass non-zero padding values to perform a rect-based hit test. | 46 // Pass non-zero padding values to perform a rect-based hit test. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 IntRect boundingBox() const { return m_boundingBox; } | 59 IntRect boundingBox() const { return m_boundingBox; } |
| 59 | 60 |
| 60 static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigne
d rightPadding, unsigned bottomPadding, unsigned leftPadding); | 61 static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigne
d rightPadding, unsigned bottomPadding, unsigned leftPadding); |
| 61 int topPadding() const { return roundedPoint().y() - m_boundingBox.y(); } | 62 int topPadding() const { return roundedPoint().y() - m_boundingBox.y(); } |
| 62 int rightPadding() const { return m_boundingBox.maxX() - roundedPoint().x()
- 1; } | 63 int rightPadding() const { return m_boundingBox.maxX() - roundedPoint().x()
- 1; } |
| 63 int bottomPadding() const { return m_boundingBox.maxY() - roundedPoint().y()
- 1; } | 64 int bottomPadding() const { return m_boundingBox.maxY() - roundedPoint().y()
- 1; } |
| 64 int leftPadding() const { return roundedPoint().x() - m_boundingBox.x(); } | 65 int leftPadding() const { return roundedPoint().x() - m_boundingBox.x(); } |
| 65 | 66 |
| 66 bool intersects(const LayoutRect&) const; | 67 bool intersects(const LayoutRect&) const; |
| 67 bool intersects(const FloatRect&) const; | 68 bool intersects(const FloatRect&) const; |
| 68 bool intersects(const RoundedRect&) const; | 69 bool intersects(const FloatRoundedRect&) const; |
| 69 bool containsPoint(const FloatPoint&) const; | 70 bool containsPoint(const FloatPoint&) const; |
| 70 | 71 |
| 71 const FloatPoint& transformedPoint() const { return m_transformedPoint; } | 72 const FloatPoint& transformedPoint() const { return m_transformedPoint; } |
| 72 const FloatQuad& transformedRect() const { return m_transformedRect; } | 73 const FloatQuad& transformedRect() const { return m_transformedRect; } |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 template<typename RectType> | 76 template<typename RectType> |
| 76 bool intersectsRect(const RectType&) const; | 77 bool intersectsRect(const RectType&) const; |
| 77 void move(const LayoutSize& offset); | 78 void move(const LayoutSize& offset); |
| 78 | 79 |
| 79 // This is cached forms of the more accurate point and area below. | 80 // This is cached forms of the more accurate point and area below. |
| 80 LayoutPoint m_point; | 81 LayoutPoint m_point; |
| 81 IntRect m_boundingBox; | 82 IntRect m_boundingBox; |
| 82 | 83 |
| 83 FloatPoint m_transformedPoint; | 84 FloatPoint m_transformedPoint; |
| 84 FloatQuad m_transformedRect; | 85 FloatQuad m_transformedRect; |
| 85 | 86 |
| 86 bool m_isRectBased; | 87 bool m_isRectBased; |
| 87 bool m_isRectilinear; | 88 bool m_isRectilinear; |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace blink | 91 } // namespace blink |
| 91 | 92 |
| 92 #endif // HitTestLocation_h | 93 #endif // HitTestLocation_h |
| OLD | NEW |