| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 public: | 49 public: |
| 50 explicit EventPath(Node&, Event* = nullptr); | 50 explicit EventPath(Node&, Event* = nullptr); |
| 51 | 51 |
| 52 void initializeWith(Node&, Event*); | 52 void initializeWith(Node&, Event*); |
| 53 | 53 |
| 54 NodeEventContext& operator[](size_t index) { return m_nodeEventContexts[inde
x]; } | 54 NodeEventContext& operator[](size_t index) { return m_nodeEventContexts[inde
x]; } |
| 55 const NodeEventContext& operator[](size_t index) const { return m_nodeEventC
ontexts[index]; } | 55 const NodeEventContext& operator[](size_t index) const { return m_nodeEventC
ontexts[index]; } |
| 56 NodeEventContext& at(size_t index) { return m_nodeEventContexts[index]; } | 56 NodeEventContext& at(size_t index) { return m_nodeEventContexts[index]; } |
| 57 NodeEventContext& last() { return m_nodeEventContexts[size() - 1]; } | 57 NodeEventContext& last() { return m_nodeEventContexts[size() - 1]; } |
| 58 | 58 |
| 59 WindowEventContext& windowEventContext() { ASSERT(m_windowEventContext); ret
urn *m_windowEventContext; } | 59 WindowEventContext& windowEventContext() { DCHECK(m_windowEventContext); ret
urn *m_windowEventContext; } |
| 60 void ensureWindowEventContext(); | 60 void ensureWindowEventContext(); |
| 61 | 61 |
| 62 bool isEmpty() const { return m_nodeEventContexts.isEmpty(); } | 62 bool isEmpty() const { return m_nodeEventContexts.isEmpty(); } |
| 63 size_t size() const { return m_nodeEventContexts.size(); } | 63 size_t size() const { return m_nodeEventContexts.size(); } |
| 64 | 64 |
| 65 void adjustForRelatedTarget(Node&, EventTarget* relatedTarget); | 65 void adjustForRelatedTarget(Node&, EventTarget* relatedTarget); |
| 66 void adjustForTouchEvent(TouchEvent&); | 66 void adjustForTouchEvent(TouchEvent&); |
| 67 | 67 |
| 68 static EventTarget* eventTargetRespectingTargetRules(Node&); | 68 static EventTarget* eventTargetRespectingTargetRules(Node&); |
| 69 | 69 |
| 70 DECLARE_TRACE(); | 70 DECLARE_TRACE(); |
| 71 void clear() | 71 void clear() |
| 72 { | 72 { |
| 73 m_nodeEventContexts.clear(); | 73 m_nodeEventContexts.clear(); |
| 74 m_treeScopeEventContexts.clear(); | 74 m_treeScopeEventContexts.clear(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 EventPath(); | 78 EventPath(); |
| 79 | 79 |
| 80 void initialize(); | 80 void initialize(); |
| 81 void calculatePath(); | 81 void calculatePath(); |
| 82 void calculateAdjustedTargets(); | 82 void calculateAdjustedTargets(); |
| 83 void calculateTreeOrderAndSetNearestAncestorClosedTree(); | 83 void calculateTreeOrderAndSetNearestAncestorClosedTree(); |
| 84 | 84 |
| 85 void shrink(size_t newSize) { ASSERT(!m_windowEventContext); m_nodeEventCont
exts.shrink(newSize); } | 85 void shrink(size_t newSize) { DCHECK(!m_windowEventContext); m_nodeEventCont
exts.shrink(newSize); } |
| 86 | 86 |
| 87 void retargetRelatedTarget(const Node& relatedTargetNode); | 87 void retargetRelatedTarget(const Node& relatedTargetNode); |
| 88 | 88 |
| 89 void shrinkForRelatedTarget(const Node& target, const Node& relatedTarget); | 89 void shrinkForRelatedTarget(const Node& target, const Node& relatedTarget); |
| 90 | 90 |
| 91 void adjustTouchList(const TouchList*, HeapVector<Member<TouchList>> adjuste
dTouchList, const HeapVector<Member<TreeScope>>& treeScopes); | 91 void adjustTouchList(const TouchList*, HeapVector<Member<TouchList>> adjuste
dTouchList, const HeapVector<Member<TreeScope>>& treeScopes); |
| 92 | 92 |
| 93 using TreeScopeEventContextMap = HeapHashMap<Member<TreeScope>, Member<TreeS
copeEventContext>>; | 93 using TreeScopeEventContextMap = HeapHashMap<Member<TreeScope>, Member<TreeS
copeEventContext>>; |
| 94 TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, Tree
Scope*, TreeScopeEventContextMap&); | 94 TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, Tree
Scope*, TreeScopeEventContextMap&); |
| 95 | 95 |
| 96 using RelatedTargetMap = HeapHashMap<Member<TreeScope>, Member<EventTarget>>
; | 96 using RelatedTargetMap = HeapHashMap<Member<TreeScope>, Member<EventTarget>>
; |
| 97 | 97 |
| 98 static void buildRelatedNodeMap(const Node&, RelatedTargetMap&); | 98 static void buildRelatedNodeMap(const Node&, RelatedTargetMap&); |
| 99 static EventTarget* findRelatedNode(TreeScope&, RelatedTargetMap&); | 99 static EventTarget* findRelatedNode(TreeScope&, RelatedTargetMap&); |
| 100 | 100 |
| 101 #if ENABLE(ASSERT) | 101 #if DCHECK_IS_ON() |
| 102 static void checkReachability(TreeScope&, TouchList&); | 102 static void checkReachability(TreeScope&, TouchList&); |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 const NodeEventContext& topNodeEventContext(); | 105 const NodeEventContext& topNodeEventContext(); |
| 106 | 106 |
| 107 HeapVector<NodeEventContext> m_nodeEventContexts; | 107 HeapVector<NodeEventContext> m_nodeEventContexts; |
| 108 Member<Node> m_node; | 108 Member<Node> m_node; |
| 109 Member<Event> m_event; | 109 Member<Event> m_event; |
| 110 HeapVector<Member<TreeScopeEventContext>> m_treeScopeEventContexts; | 110 HeapVector<Member<TreeScopeEventContext>> m_treeScopeEventContexts; |
| 111 Member<WindowEventContext> m_windowEventContext; | 111 Member<WindowEventContext> m_windowEventContext; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| 115 | 115 |
| 116 #endif | 116 #endif |
| OLD | NEW |