| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 EventTarget* target() const { return m_target.get(); } | 53 EventTarget* target() const { return m_target.get(); } |
| 54 void setTarget(PassRefPtr<EventTarget>); | 54 void setTarget(PassRefPtr<EventTarget>); |
| 55 | 55 |
| 56 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 56 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
| 57 void setRelatedTarget(PassRefPtr<EventTarget>); | 57 void setRelatedTarget(PassRefPtr<EventTarget>); |
| 58 | 58 |
| 59 TouchEventContext* touchEventContext() const { return m_touchEventContext.ge
t(); } | 59 TouchEventContext* touchEventContext() const { return m_touchEventContext.ge
t(); } |
| 60 TouchEventContext* ensureTouchEventContext(); | 60 TouchEventContext* ensureTouchEventContext(); |
| 61 | 61 |
| 62 PassRefPtr<NodeList> ensureEventPath(EventPath&); | 62 PassRefPtrWillBeRawPtr<NodeList> ensureEventPath(EventPath&); |
| 63 | 63 |
| 64 bool isInclusiveAncestorOf(const TreeScopeEventContext&); | 64 bool isInclusiveAncestorOf(const TreeScopeEventContext&); |
| 65 void addChild(TreeScopeEventContext& child) { m_children.append(&child); } | 65 void addChild(TreeScopeEventContext& child) { m_children.append(&child); } |
| 66 | 66 |
| 67 // For ancestor-descendant relationship check in Q(1). | 67 // For ancestor-descendant relationship check in Q(1). |
| 68 // Preprocessing takes O(N). | 68 // Preprocessing takes O(N). |
| 69 int calculatePrePostOrderNumber(int orderNumber); | 69 int calculatePrePostOrderNumber(int orderNumber); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 TreeScopeEventContext(TreeScope&); | 72 TreeScopeEventContext(TreeScope&); |
| 73 | 73 |
| 74 #ifndef NDEBUG | 74 #ifndef NDEBUG |
| 75 bool isUnreachableNode(EventTarget&); | 75 bool isUnreachableNode(EventTarget&); |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 TreeScope& m_treeScope; | 78 TreeScope& m_treeScope; |
| 79 RefPtr<EventTarget> m_target; | 79 RefPtr<EventTarget> m_target; |
| 80 RefPtr<EventTarget> m_relatedTarget; | 80 RefPtr<EventTarget> m_relatedTarget; |
| 81 RefPtr<NodeList> m_eventPath; | 81 RefPtrWillBePersistent<NodeList> m_eventPath; |
| 82 RefPtrWillBePersistent<TouchEventContext> m_touchEventContext; | 82 RefPtrWillBePersistent<TouchEventContext> m_touchEventContext; |
| 83 | 83 |
| 84 Vector<TreeScopeEventContext*> m_children; | 84 Vector<TreeScopeEventContext*> m_children; |
| 85 int m_preOrder; | 85 int m_preOrder; |
| 86 int m_postOrder; | 86 int m_postOrder; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #ifndef NDEBUG | 89 #ifndef NDEBUG |
| 90 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) | 90 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) |
| 91 { | 91 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 110 | 110 |
| 111 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon
text& other) | 111 inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventCon
text& other) |
| 112 { | 112 { |
| 113 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot
her.m_postOrder != -1); | 113 ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && ot
her.m_postOrder != -1); |
| 114 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; | 114 return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; |
| 115 } | 115 } |
| 116 | 116 |
| 117 } | 117 } |
| 118 | 118 |
| 119 #endif // TreeScopeEventContext_h | 119 #endif // TreeScopeEventContext_h |
| OLD | NEW |