1 /* 2 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 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 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef HitTestRequest_h 24 #define HitTestRequest_h 25 26 namespace WebCore { 27 28 class HitTestRequest { 29 public: 30 enum RequestType { 31 ReadOnly = 1 << 1, 32 Active = 1 << 2, 33 Move = 1 << 3, 34 Release = 1 << 4, 35 IgnoreClipping = 1 << 5, 36 SVGClipContent = 1 << 6, 37 TouchEvent = 1 << 7, 38 // Deprecated. Instead of this, callers should call HitTestResult::setToNodesInDocumentTreeScope() explicitly. 39 ConfusingAndOftenMisusedDisallowShadowContent = 1 << 8, 40 AllowFrameScrollbars = 1 << 9, 41 AllowChildFrameContent = 1 << 10, 42 ChildFrameHitTest = 1 << 11, 43 IgnorePointerEventsNone = 1 << 12, 44 }; 45 46 typedef unsigned HitTestRequestType; 47 HitTestRequest(HitTestRequestType requestType)48 HitTestRequest(HitTestRequestType requestType) 49 : m_requestType(requestType) 50 { 51 } 52 readOnly()53 bool readOnly() const { return m_requestType & ReadOnly; } active()54 bool active() const { return m_requestType & Active; } move()55 bool move() const { return m_requestType & Move; } release()56 bool release() const { return m_requestType & Release; } ignoreClipping()57 bool ignoreClipping() const { return m_requestType & IgnoreClipping; } svgClipContent()58 bool svgClipContent() const { return m_requestType & SVGClipContent; } touchEvent()59 bool touchEvent() const { return m_requestType & TouchEvent; } mouseEvent()60 bool mouseEvent() const { return !touchEvent(); } disallowsShadowContent()61 bool disallowsShadowContent() const { return m_requestType & ConfusingAndOftenMisusedDisallowShadowContent; } allowsFrameScrollbars()62 bool allowsFrameScrollbars() const { return m_requestType & AllowFrameScrollbars; } allowsChildFrameContent()63 bool allowsChildFrameContent() const { return m_requestType & AllowChildFrameContent; } isChildFrameHitTest()64 bool isChildFrameHitTest() const { return m_requestType & ChildFrameHitTest; } ignorePointerEventsNone()65 bool ignorePointerEventsNone() const { return m_requestType & IgnorePointerEventsNone; } 66 67 // Convenience functions touchMove()68 bool touchMove() const { return move() && touchEvent(); } touchRelease()69 bool touchRelease() const { return release() && touchEvent(); } 70 type()71 HitTestRequestType type() const { return m_requestType; } 72 73 private: 74 HitTestRequestType m_requestType; 75 }; 76 77 } // namespace WebCore 78 79 #endif // HitTestRequest_h 80