| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #ifndef HitTestRequest_h | 23 #ifndef HitTestRequest_h |
| 24 #define HitTestRequest_h | 24 #define HitTestRequest_h |
| 25 | 25 |
| 26 #include "wtf/Assertions.h" |
| 27 |
| 26 namespace blink { | 28 namespace blink { |
| 27 | 29 |
| 28 class HitTestRequest { | 30 class HitTestRequest { |
| 29 public: | 31 public: |
| 30 enum RequestType { | 32 enum RequestType { |
| 31 ReadOnly = 1 << 1, | 33 ReadOnly = 1 << 1, |
| 32 Active = 1 << 2, | 34 Active = 1 << 2, |
| 33 Move = 1 << 3, | 35 Move = 1 << 3, |
| 34 Release = 1 << 4, | 36 Release = 1 << 4, |
| 35 IgnoreClipping = 1 << 5, | 37 IgnoreClipping = 1 << 5, |
| 36 SVGClipContent = 1 << 6, | 38 SVGClipContent = 1 << 6, |
| 37 TouchEvent = 1 << 7, | 39 TouchEvent = 1 << 7, |
| 38 AllowChildFrameContent = 1 << 8, | 40 AllowChildFrameContent = 1 << 8, |
| 39 ChildFrameHitTest = 1 << 9, | 41 ChildFrameHitTest = 1 << 9, |
| 40 IgnorePointerEventsNone = 1 << 10, | 42 IgnorePointerEventsNone = 1 << 10, |
| 43 // Collect a list of nodes instead of just one. |
| 44 // (This is for elementsFromPoint and rect-based tests). |
| 45 ListBased = 1 << 11, |
| 46 // When using list-based testing, this flag causes us to continue hit |
| 47 // testing after a hit has been found. |
| 48 PenetratingList = 1 << 12, |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 typedef unsigned HitTestRequestType; | 51 typedef unsigned HitTestRequestType; |
| 44 | 52 |
| 45 HitTestRequest(HitTestRequestType requestType) | 53 HitTestRequest(HitTestRequestType requestType) |
| 46 : m_requestType(requestType) | 54 : m_requestType(requestType) |
| 47 { | 55 { |
| 56 // Penetrating lists should also be list-based. |
| 57 ASSERT(!(requestType & PenetratingList) || (requestType & ListBased)); |
| 48 } | 58 } |
| 49 | 59 |
| 50 bool readOnly() const { return m_requestType & ReadOnly; } | 60 bool readOnly() const { return m_requestType & ReadOnly; } |
| 51 bool active() const { return m_requestType & Active; } | 61 bool active() const { return m_requestType & Active; } |
| 52 bool move() const { return m_requestType & Move; } | 62 bool move() const { return m_requestType & Move; } |
| 53 bool release() const { return m_requestType & Release; } | 63 bool release() const { return m_requestType & Release; } |
| 54 bool ignoreClipping() const { return m_requestType & IgnoreClipping; } | 64 bool ignoreClipping() const { return m_requestType & IgnoreClipping; } |
| 55 bool svgClipContent() const { return m_requestType & SVGClipContent; } | 65 bool svgClipContent() const { return m_requestType & SVGClipContent; } |
| 56 bool touchEvent() const { return m_requestType & TouchEvent; } | 66 bool touchEvent() const { return m_requestType & TouchEvent; } |
| 57 bool allowsChildFrameContent() const { return m_requestType & AllowChildFram
eContent; } | 67 bool allowsChildFrameContent() const { return m_requestType & AllowChildFram
eContent; } |
| 58 bool isChildFrameHitTest() const { return m_requestType & ChildFrameHitTest;
} | 68 bool isChildFrameHitTest() const { return m_requestType & ChildFrameHitTest;
} |
| 59 bool ignorePointerEventsNone() const { return m_requestType & IgnorePointerE
ventsNone; } | 69 bool ignorePointerEventsNone() const { return m_requestType & IgnorePointerE
ventsNone; } |
| 70 bool listBased() const { return m_requestType & ListBased; } |
| 71 bool penetratingList() const { return m_requestType & PenetratingList; } |
| 60 | 72 |
| 61 // Convenience functions | 73 // Convenience functions |
| 62 bool touchMove() const { return move() && touchEvent(); } | 74 bool touchMove() const { return move() && touchEvent(); } |
| 63 | 75 |
| 64 HitTestRequestType type() const { return m_requestType; } | 76 HitTestRequestType type() const { return m_requestType; } |
| 65 | 77 |
| 66 private: | 78 private: |
| 67 HitTestRequestType m_requestType; | 79 HitTestRequestType m_requestType; |
| 68 }; | 80 }; |
| 69 | 81 |
| 70 } // namespace blink | 82 } // namespace blink |
| 71 | 83 |
| 72 #endif // HitTestRequest_h | 84 #endif // HitTestRequest_h |
| OLD | NEW |