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 28 matching lines...) Expand all Loading... |
39 : m_node(node) | 39 : m_node(node) |
40 , m_currentTarget(currentTarget) | 40 , m_currentTarget(currentTarget) |
41 { | 41 { |
42 ASSERT(m_node); | 42 ASSERT(m_node); |
43 } | 43 } |
44 | 44 |
45 EventContext::~EventContext() | 45 EventContext::~EventContext() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 void EventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes) | 49 void TreeScopeEventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes) |
50 { | 50 { |
51 m_eventPath = StaticNodeList::adopt(nodes); | 51 m_eventPath = StaticNodeList::adopt(nodes); |
52 } | 52 } |
53 | 53 |
54 void EventContext::handleLocalEvents(Event* event) const | 54 void EventContext::handleLocalEvents(Event* event) const |
55 { | 55 { |
56 if (m_touchEventContext) { | 56 if (touchEventContext()) { |
57 m_touchEventContext->handleLocalEvents(event); | 57 touchEventContext()->handleLocalEvents(event); |
58 } else if (m_relatedTarget && event->isMouseEvent()) { | 58 } else if (relatedTarget()) { |
59 toMouseEvent(event)->setRelatedTarget(m_relatedTarget.get()); | 59 if (event->isMouseEvent()) { |
60 } else if (m_relatedTarget && event->isFocusEvent()) { | 60 toMouseEvent(event)->setRelatedTarget(relatedTarget()); |
61 toFocusEvent(event)->setRelatedTarget(m_relatedTarget.get()); | 61 } else if (event->isFocusEvent()) { |
| 62 toFocusEvent(event)->setRelatedTarget(relatedTarget()); |
| 63 } |
62 } | 64 } |
63 event->setTarget(m_target); | 65 event->setTarget(target()); |
64 event->setCurrentTarget(m_currentTarget.get()); | 66 event->setCurrentTarget(m_currentTarget.get()); |
65 m_node->handleLocalEvents(event); | 67 m_node->handleLocalEvents(event); |
66 } | 68 } |
67 | 69 |
68 TouchEventContext* EventContext::ensureTouchEventContext() | 70 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext() |
69 { | 71 { |
70 if (!m_touchEventContext) | 72 if (!m_touchEventContext) |
71 m_touchEventContext = TouchEventContext::create(); | 73 m_touchEventContext = TouchEventContext::create(); |
72 return m_touchEventContext.get(); | 74 return m_touchEventContext.get(); |
73 } | 75 } |
74 | 76 |
75 PassRefPtr<TouchEventContext> TouchEventContext::create() | 77 PassRefPtr<TouchEventContext> TouchEventContext::create() |
76 { | 78 { |
77 return adoptRef(new TouchEventContext); | 79 return adoptRef(new TouchEventContext); |
78 } | 80 } |
(...skipping 11 matching lines...) Expand all Loading... |
90 | 92 |
91 void TouchEventContext::handleLocalEvents(Event* event) const | 93 void TouchEventContext::handleLocalEvents(Event* event) const |
92 { | 94 { |
93 ASSERT(event->isTouchEvent()); | 95 ASSERT(event->isTouchEvent()); |
94 TouchEvent* touchEvent = toTouchEvent(event); | 96 TouchEvent* touchEvent = toTouchEvent(event); |
95 touchEvent->setTouches(m_touches); | 97 touchEvent->setTouches(m_touches); |
96 touchEvent->setTargetTouches(m_targetTouches); | 98 touchEvent->setTargetTouches(m_targetTouches); |
97 touchEvent->setChangedTouches(m_changedTouches); | 99 touchEvent->setChangedTouches(m_changedTouches); |
98 } | 100 } |
99 | 101 |
| 102 PassRefPtr<TreeScopeEventContext> TreeScopeEventContext::create(TreeScope& treeS
cope) |
| 103 { |
| 104 return adoptRef(new TreeScopeEventContext(treeScope)); |
100 } | 105 } |
| 106 |
| 107 TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope) |
| 108 : m_treeScope(treeScope) |
| 109 { |
| 110 } |
| 111 |
| 112 TreeScopeEventContext::~TreeScopeEventContext() |
| 113 { |
| 114 } |
| 115 |
| 116 } |
OLD | NEW |