OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "SVGNames.h" | 32 #include "SVGNames.h" |
33 #include "SVGUseElement.h" | 33 #include "SVGUseElement.h" |
34 #endif | 34 #endif |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class EventTarget; | 38 class EventTarget; |
39 class FocusEvent; | 39 class FocusEvent; |
40 class MouseEvent; | 40 class MouseEvent; |
41 class Node; | 41 class Node; |
42 #if ENABLE(TOUCH_EVENTS) | |
43 class TouchEvent; | 42 class TouchEvent; |
44 #endif | |
45 class TreeScope; | 43 class TreeScope; |
46 | 44 |
47 enum EventDispatchBehavior { | 45 enum EventDispatchBehavior { |
48 RetargetEvent, | 46 RetargetEvent, |
49 StayInsideShadowDOM | 47 StayInsideShadowDOM |
50 }; | 48 }; |
51 | 49 |
52 class EventRetargeter { | 50 class EventRetargeter { |
53 public: | 51 public: |
54 static void calculateEventPath(Node*, Event*, EventPath&); | 52 static void calculateEventPath(Node*, Event*, EventPath&); |
55 static void adjustForMouseEvent(Node*, const MouseEvent&, EventPath&); | 53 static void adjustForMouseEvent(Node*, const MouseEvent&, EventPath&); |
56 static void adjustForFocusEvent(Node*, const FocusEvent&, EventPath&); | 54 static void adjustForFocusEvent(Node*, const FocusEvent&, EventPath&); |
57 #if ENABLE(TOUCH_EVENTS) | |
58 typedef Vector<RefPtr<TouchList> > EventPathTouchLists; | 55 typedef Vector<RefPtr<TouchList> > EventPathTouchLists; |
59 static void adjustForTouchEvent(Node*, const TouchEvent&, EventPath&); | 56 static void adjustForTouchEvent(Node*, const TouchEvent&, EventPath&); |
60 #endif | |
61 static EventTarget* eventTargetRespectingTargetRules(Node* referenceNode); | 57 static EventTarget* eventTargetRespectingTargetRules(Node* referenceNode); |
62 | 58 |
63 private: | 59 private: |
64 typedef Vector<RefPtr<Node> > AdjustedNodes; | 60 typedef Vector<RefPtr<Node> > AdjustedNodes; |
65 typedef HashMap<TreeScope*, Node*> RelatedNodeMap; | 61 typedef HashMap<TreeScope*, Node*> RelatedNodeMap; |
66 enum EventWithRelatedTargetDispatchBehavior { | 62 enum EventWithRelatedTargetDispatchBehavior { |
67 StopAtBoundaryIfNeeded, | 63 StopAtBoundaryIfNeeded, |
68 DoesNotStopAtBoundary | 64 DoesNotStopAtBoundary |
69 }; | 65 }; |
70 static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget,
EventPath&); | 66 static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget,
EventPath&); |
71 static void calculateAdjustedNodes(const Node*, const Node* relatedNode, Eve
ntWithRelatedTargetDispatchBehavior, EventPath&, AdjustedNodes&); | 67 static void calculateAdjustedNodes(const Node*, const Node* relatedNode, Eve
ntWithRelatedTargetDispatchBehavior, EventPath&, AdjustedNodes&); |
72 static void buildRelatedNodeMap(const Node*, RelatedNodeMap&); | 68 static void buildRelatedNodeMap(const Node*, RelatedNodeMap&); |
73 static Node* findRelatedNode(TreeScope*, RelatedNodeMap&); | 69 static Node* findRelatedNode(TreeScope*, RelatedNodeMap&); |
74 #if ENABLE(TOUCH_EVENTS) | |
75 static void adjustTouchList(const Node*, const TouchList*, const EventPath&,
EventPathTouchLists&); | 70 static void adjustTouchList(const Node*, const TouchList*, const EventPath&,
EventPathTouchLists&); |
76 #endif | |
77 }; | 71 }; |
78 | 72 |
79 inline EventTarget* EventRetargeter::eventTargetRespectingTargetRules(Node* refe
renceNode) | 73 inline EventTarget* EventRetargeter::eventTargetRespectingTargetRules(Node* refe
renceNode) |
80 { | 74 { |
81 ASSERT(referenceNode); | 75 ASSERT(referenceNode); |
82 | 76 |
83 if (referenceNode->isPseudoElement()) | 77 if (referenceNode->isPseudoElement()) |
84 return referenceNode->parentNode(); | 78 return referenceNode->parentNode(); |
85 | 79 |
86 #if ENABLE(SVG) | 80 #if ENABLE(SVG) |
(...skipping 10 matching lines...) Expand all Loading... |
97 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(
referenceNode)) | 91 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(
referenceNode)) |
98 return instance; | 92 return instance; |
99 #endif | 93 #endif |
100 | 94 |
101 return referenceNode; | 95 return referenceNode; |
102 } | 96 } |
103 | 97 |
104 } | 98 } |
105 | 99 |
106 #endif // EventRetargeter_h | 100 #endif // EventRetargeter_h |
OLD | NEW |