| 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) |
| 42 class TouchEvent; | 43 class TouchEvent; |
| 44 #endif |
| 43 class TreeScope; | 45 class TreeScope; |
| 44 | 46 |
| 45 enum EventDispatchBehavior { | 47 enum EventDispatchBehavior { |
| 46 RetargetEvent, | 48 RetargetEvent, |
| 47 StayInsideShadowDOM | 49 StayInsideShadowDOM |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 class EventRetargeter { | 52 class EventRetargeter { |
| 51 public: | 53 public: |
| 52 static void calculateEventPath(Node*, Event*, EventPath&); | 54 static void calculateEventPath(Node*, Event*, EventPath&); |
| 53 static void adjustForMouseEvent(Node*, const MouseEvent&, EventPath&); | 55 static void adjustForMouseEvent(Node*, const MouseEvent&, EventPath&); |
| 54 static void adjustForFocusEvent(Node*, const FocusEvent&, EventPath&); | 56 static void adjustForFocusEvent(Node*, const FocusEvent&, EventPath&); |
| 57 #if ENABLE(TOUCH_EVENTS) |
| 55 typedef Vector<RefPtr<TouchList> > EventPathTouchLists; | 58 typedef Vector<RefPtr<TouchList> > EventPathTouchLists; |
| 56 static void adjustForTouchEvent(Node*, const TouchEvent&, EventPath&); | 59 static void adjustForTouchEvent(Node*, const TouchEvent&, EventPath&); |
| 60 #endif |
| 57 static EventTarget* eventTargetRespectingTargetRules(Node* referenceNode); | 61 static EventTarget* eventTargetRespectingTargetRules(Node* referenceNode); |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 typedef Vector<RefPtr<Node> > AdjustedNodes; | 64 typedef Vector<RefPtr<Node> > AdjustedNodes; |
| 61 typedef HashMap<TreeScope*, Node*> RelatedNodeMap; | 65 typedef HashMap<TreeScope*, Node*> RelatedNodeMap; |
| 62 enum EventWithRelatedTargetDispatchBehavior { | 66 enum EventWithRelatedTargetDispatchBehavior { |
| 63 StopAtBoundaryIfNeeded, | 67 StopAtBoundaryIfNeeded, |
| 64 DoesNotStopAtBoundary | 68 DoesNotStopAtBoundary |
| 65 }; | 69 }; |
| 66 static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget,
EventPath&); | 70 static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget,
EventPath&); |
| 67 static void calculateAdjustedNodes(const Node*, const Node* relatedNode, Eve
ntWithRelatedTargetDispatchBehavior, EventPath&, AdjustedNodes&); | 71 static void calculateAdjustedNodes(const Node*, const Node* relatedNode, Eve
ntWithRelatedTargetDispatchBehavior, EventPath&, AdjustedNodes&); |
| 68 static void buildRelatedNodeMap(const Node*, RelatedNodeMap&); | 72 static void buildRelatedNodeMap(const Node*, RelatedNodeMap&); |
| 69 static Node* findRelatedNode(TreeScope*, RelatedNodeMap&); | 73 static Node* findRelatedNode(TreeScope*, RelatedNodeMap&); |
| 74 #if ENABLE(TOUCH_EVENTS) |
| 70 static void adjustTouchList(const Node*, const TouchList*, const EventPath&,
EventPathTouchLists&); | 75 static void adjustTouchList(const Node*, const TouchList*, const EventPath&,
EventPathTouchLists&); |
| 76 #endif |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 inline EventTarget* EventRetargeter::eventTargetRespectingTargetRules(Node* refe
renceNode) | 79 inline EventTarget* EventRetargeter::eventTargetRespectingTargetRules(Node* refe
renceNode) |
| 74 { | 80 { |
| 75 ASSERT(referenceNode); | 81 ASSERT(referenceNode); |
| 76 | 82 |
| 77 if (referenceNode->isPseudoElement()) | 83 if (referenceNode->isPseudoElement()) |
| 78 return referenceNode->parentNode(); | 84 return referenceNode->parentNode(); |
| 79 | 85 |
| 80 #if ENABLE(SVG) | 86 #if ENABLE(SVG) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(
referenceNode)) | 97 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(
referenceNode)) |
| 92 return instance; | 98 return instance; |
| 93 #endif | 99 #endif |
| 94 | 100 |
| 95 return referenceNode; | 101 return referenceNode; |
| 96 } | 102 } |
| 97 | 103 |
| 98 } | 104 } |
| 99 | 105 |
| 100 #endif // EventRetargeter_h | 106 #endif // EventRetargeter_h |
| OLD | NEW |