| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 class EventContext { | 91 class EventContext { |
| 92 public: | 92 public: |
| 93 // FIXME: Use ContainerNode instead of Node. | 93 // FIXME: Use ContainerNode instead of Node. |
| 94 EventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget); | 94 EventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget); |
| 95 ~EventContext(); | 95 ~EventContext(); |
| 96 | 96 |
| 97 Node* node() const { return m_node.get(); } | 97 Node* node() const { return m_node.get(); } |
| 98 EventTarget* currentTarget() const { return m_currentTarget.get(); } | 98 EventTarget* currentTarget() const { return m_currentTarget.get(); } |
| 99 | 99 |
| 100 TreeScopeEventContext* sharedEventContext() const { return m_sharedEventCont
ext.get(); } | 100 TreeScopeEventContext* treeScopeEventContext() const { return m_treeScopeEve
ntContext.get(); } |
| 101 void setSharedEventContext(PassRefPtr<TreeScopeEventContext> sharedEventCont
ext) { m_sharedEventContext = sharedEventContext; } | 101 void setTreeScopeEventContext(PassRefPtr<TreeScopeEventContext> prpTreeScope
EventContext) { m_treeScopeEventContext = prpTreeScopeEventContext; } |
| 102 | 102 |
| 103 EventTarget* target() const { return m_sharedEventContext->target(); } | 103 EventTarget* target() const { return m_treeScopeEventContext->target(); } |
| 104 EventTarget* relatedTarget() const { return m_sharedEventContext->relatedTar
get(); } | 104 EventTarget* relatedTarget() const { return m_treeScopeEventContext->related
Target(); } |
| 105 TouchEventContext* touchEventContext() const { return m_sharedEventContext->
touchEventContext(); } | 105 TouchEventContext* touchEventContext() const { return m_treeScopeEventContex
t->touchEventContext(); } |
| 106 PassRefPtr<NodeList> eventPath() const { return m_sharedEventContext->eventP
ath(); } | 106 PassRefPtr<NodeList> eventPath() const { return m_treeScopeEventContext->eve
ntPath(); } |
| 107 | 107 |
| 108 bool currentTargetSameAsTarget() const { return m_currentTarget.get() == tar
get(); } | 108 bool currentTargetSameAsTarget() const { return m_currentTarget.get() == tar
get(); } |
| 109 void handleLocalEvents(Event*) const; | 109 void handleLocalEvents(Event*) const; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 RefPtr<Node> m_node; | 112 RefPtr<Node> m_node; |
| 113 RefPtr<EventTarget> m_currentTarget; | 113 RefPtr<EventTarget> m_currentTarget; |
| 114 RefPtr<TreeScopeEventContext> m_sharedEventContext; | 114 RefPtr<TreeScopeEventContext> m_treeScopeEventContext; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 #ifndef NDEBUG | 117 #ifndef NDEBUG |
| 118 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget* target) | 118 inline bool TreeScopeEventContext::isUnreachableNode(EventTarget* target) |
| 119 { | 119 { |
| 120 // FIXME: Checks also for SVG elements. | 120 // FIXME: Checks also for SVG elements. |
| 121 return target && target->toNode() && !target->toNode()->isSVGElement() && !t
arget->toNode()->treeScope().isInclusiveAncestorOf(m_treeScope); | 121 return target && target->toNode() && !target->toNode()->isSVGElement() && !t
arget->toNode()->treeScope().isInclusiveAncestorOf(m_treeScope); |
| 122 } | 122 } |
| 123 #endif | 123 #endif |
| 124 | 124 |
| 125 inline void TreeScopeEventContext::setTarget(PassRefPtr<EventTarget> target) | 125 inline void TreeScopeEventContext::setTarget(PassRefPtr<EventTarget> target) |
| 126 { | 126 { |
| 127 ASSERT(!isUnreachableNode(target.get())); | 127 ASSERT(!isUnreachableNode(target.get())); |
| 128 m_target = target; | 128 m_target = target; |
| 129 } | 129 } |
| 130 | 130 |
| 131 inline void TreeScopeEventContext::setRelatedTarget(PassRefPtr<EventTarget> rela
tedTarget) | 131 inline void TreeScopeEventContext::setRelatedTarget(PassRefPtr<EventTarget> rela
tedTarget) |
| 132 { | 132 { |
| 133 ASSERT(!isUnreachableNode(relatedTarget.get())); | 133 ASSERT(!isUnreachableNode(relatedTarget.get())); |
| 134 m_relatedTarget = relatedTarget; | 134 m_relatedTarget = relatedTarget; |
| 135 } | 135 } |
| 136 | 136 |
| 137 } | 137 } |
| 138 | 138 |
| 139 #endif // EventContext_h | 139 #endif // EventContext_h |
| OLD | NEW |