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 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 RetargetEvent, | 45 RetargetEvent, |
46 StayInsideShadowDOM | 46 StayInsideShadowDOM |
47 }; | 47 }; |
48 | 48 |
49 class EventPath { | 49 class EventPath { |
50 public: | 50 public: |
51 explicit EventPath(Event*); | 51 explicit EventPath(Event*); |
52 explicit EventPath(Node*); | 52 explicit EventPath(Node*); |
53 void resetWith(Node*); | 53 void resetWith(Node*); |
54 | 54 |
55 EventContext& operator[](size_t index) { return m_eventContexts[index]; } | 55 NodeEventContext& operator[](size_t index) { return m_nodeEventContexts[inde
x]; } |
56 const EventContext& operator[](size_t index) const { return m_eventContexts[
index]; } | 56 const NodeEventContext& operator[](size_t index) const { return m_nodeEventC
ontexts[index]; } |
57 const EventContext& last() const { return m_eventContexts[size() - 1]; } | 57 const NodeEventContext& last() const { return m_nodeEventContexts[size() - 1
]; } |
58 | 58 |
59 bool isEmpty() const { return m_eventContexts.isEmpty(); } | 59 bool isEmpty() const { return m_nodeEventContexts.isEmpty(); } |
60 size_t size() const { return m_eventContexts.size(); } | 60 size_t size() const { return m_nodeEventContexts.size(); } |
61 | 61 |
62 void adjustForRelatedTarget(Node*, EventTarget* relatedTarget); | 62 void adjustForRelatedTarget(Node*, EventTarget* relatedTarget); |
63 void adjustForTouchEvent(Node*, TouchEvent&); | 63 void adjustForTouchEvent(Node*, TouchEvent&); |
64 | 64 |
65 static Node* parent(Node*); | 65 static Node* parent(Node*); |
66 static EventTarget* eventTargetRespectingTargetRules(Node*); | 66 static EventTarget* eventTargetRespectingTargetRules(Node*); |
67 | 67 |
68 private: | 68 private: |
69 EventPath(); | 69 EventPath(); |
70 | 70 |
71 EventContext& at(size_t index) { return m_eventContexts[index]; } | 71 NodeEventContext& at(size_t index) { return m_nodeEventContexts[index]; } |
72 | 72 |
73 void addEventContext(Node*); | 73 void addNodeEventContext(Node*); |
74 | 74 |
75 void calculatePath(); | 75 void calculatePath(); |
76 void calculateAdjustedTargets(); | 76 void calculateAdjustedTargets(); |
77 void calculateAdjustedEventPath(); | 77 void calculateAdjustedEventPath(); |
78 | 78 |
79 void shrink(size_t newSize) { m_eventContexts.shrink(newSize); } | 79 void shrink(size_t newSize) { m_nodeEventContexts.shrink(newSize); } |
80 void shrinkIfNeeded(const Node* target, const EventTarget* relatedTarget); | 80 void shrinkIfNeeded(const Node* target, const EventTarget* relatedTarget); |
81 | 81 |
82 void adjustTouchList(const Node*, const TouchList*, Vector<TouchList*> adjus
tedTouchList, const Vector<TreeScope*>& treeScopes); | 82 void adjustTouchList(const Node*, const TouchList*, Vector<TouchList*> adjus
tedTouchList, const Vector<TreeScope*>& treeScopes); |
83 | 83 |
84 typedef HashMap<TreeScope*, EventTarget*> RelatedTargetMap; | 84 typedef HashMap<TreeScope*, EventTarget*> RelatedTargetMap; |
85 | 85 |
86 static void buildRelatedNodeMap(const Node*, RelatedTargetMap&); | 86 static void buildRelatedNodeMap(const Node*, RelatedTargetMap&); |
87 static EventTarget* findRelatedNode(TreeScope*, RelatedTargetMap&); | 87 static EventTarget* findRelatedNode(TreeScope*, RelatedTargetMap&); |
88 | 88 |
89 #ifndef NDEBUG | 89 #ifndef NDEBUG |
90 static void checkReachability(TreeScope&, TouchList&); | 90 static void checkReachability(TreeScope&, TouchList&); |
91 #endif | 91 #endif |
92 | 92 |
93 Vector<EventContext, 64> m_eventContexts; | 93 Vector<NodeEventContext, 64> m_nodeEventContexts; |
94 Node* m_node; | 94 Node* m_node; |
95 Event* m_event; | 95 Event* m_event; |
96 Vector<RefPtr<TreeScopeEventContext> > m_treeScopeEventContexts; | 96 Vector<RefPtr<TreeScopeEventContext> > m_treeScopeEventContexts; |
97 }; | 97 }; |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 #endif | 101 #endif |
OLD | NEW |