| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2014 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 EventTarget* target() const { return m_target.get(); } | 56 EventTarget* target() const { return m_target.get(); } |
| 57 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); | 57 void setTarget(PassRefPtrWillBeRawPtr<EventTarget>); |
| 58 | 58 |
| 59 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 59 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
| 60 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget>); | 60 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget>); |
| 61 | 61 |
| 62 TouchEventContext* touchEventContext() const { return m_touchEventContext.ge
t(); } | 62 TouchEventContext* touchEventContext() const { return m_touchEventContext.ge
t(); } |
| 63 TouchEventContext* ensureTouchEventContext(); | 63 TouchEventContext* ensureTouchEventContext(); |
| 64 | 64 |
| 65 WillBeHeapVector<RefPtrWillBeRawPtr<EventTarget>>& ensureEventPath(EventPath
&); | 65 WillBeHeapVector<RefPtrWillBeMember<EventTarget>>& ensureEventPath(EventPath
&); |
| 66 | 66 |
| 67 bool isInclusiveAncestorOf(const TreeScopeEventContext&); | 67 bool isInclusiveAncestorOf(const TreeScopeEventContext&); |
| 68 void addChild(TreeScopeEventContext& child) { m_children.append(&child); } | 68 void addChild(TreeScopeEventContext& child) { m_children.append(&child); } |
| 69 | 69 |
| 70 // For ancestor-descendant relationship check in Q(1). | 70 // For ancestor-descendant relationship check in Q(1). |
| 71 // Preprocessing takes O(N). | 71 // Preprocessing takes O(N). |
| 72 int calculatePrePostOrderNumber(int orderNumber); | 72 int calculatePrePostOrderNumber(int orderNumber); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 TreeScopeEventContext(TreeScope&); | 75 TreeScopeEventContext(TreeScope&); |
| 76 | 76 |
| 77 #if ENABLE(ASSERT) | 77 #if ENABLE(ASSERT) |
| 78 bool isUnreachableNode(EventTarget&); | 78 bool isUnreachableNode(EventTarget&); |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 RawPtrWillBeMember<TreeScope> m_treeScope; | 81 RawPtrWillBeMember<TreeScope> m_treeScope; |
| 82 RefPtrWillBeMember<Node> m_rootNode; // Prevents TreeScope from being freed.
TreeScope itself isn't RefCounted. | 82 RefPtrWillBeMember<Node> m_rootNode; // Prevents TreeScope from being freed.
TreeScope itself isn't RefCounted. |
| 83 RefPtrWillBeMember<EventTarget> m_target; | 83 RefPtrWillBeMember<EventTarget> m_target; |
| 84 RefPtrWillBeMember<EventTarget> m_relatedTarget; | 84 RefPtrWillBeMember<EventTarget> m_relatedTarget; |
| 85 OwnPtrWillBeMember<WillBeHeapVector<RefPtr<EventTarget>>> m_eventPath; | 85 OwnPtrWillBeMember<WillBeHeapVector<RefPtrWillBeMember<EventTarget>>> m_even
tPath; |
| 86 RefPtrWillBeMember<TouchEventContext> m_touchEventContext; | 86 RefPtrWillBeMember<TouchEventContext> m_touchEventContext; |
| 87 | 87 |
| 88 WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext>> m_children; | 88 WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext>> m_children; |
| 89 int m_preOrder; | 89 int m_preOrder; |
| 90 int m_postOrder; | 90 int m_postOrder; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 #if ENABLE(ASSERT) | 93 #if ENABLE(ASSERT) |
| 94 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) | 94 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) |
| 95 { | 95 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 114 | 114 |
| 115 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon
text& other) | 115 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon
text& other) |
| 116 { | 116 { |
| 117 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot
her.m_postOrder != -1); | 117 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot
her.m_postOrder != -1); |
| 118 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; | 118 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } | 121 } |
| 122 | 122 |
| 123 #endif // TreeScopeEventContext_h | 123 #endif // TreeScopeEventContext_h |
| OLD | NEW |