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 17 matching lines...) Expand all Loading... |
28 #include "core/events/NodeEventContext.h" | 28 #include "core/events/NodeEventContext.h" |
29 | 29 |
30 #include "core/dom/TouchList.h" | 30 #include "core/dom/TouchList.h" |
31 #include "core/events/Event.h" | 31 #include "core/events/Event.h" |
32 #include "core/events/FocusEvent.h" | 32 #include "core/events/FocusEvent.h" |
33 #include "core/events/MouseEvent.h" | 33 #include "core/events/MouseEvent.h" |
34 #include "core/events/TouchEventContext.h" | 34 #include "core/events/TouchEventContext.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 NodeEventContext::NodeEventContext(PassRefPtrWillBeRawPtr<Node> node, PassRefPtr
<EventTarget> currentTarget) | 38 NodeEventContext::NodeEventContext(PassRefPtrWillBeRawPtr<Node> node, PassRefPtr
WillBeRawPtr<EventTarget> currentTarget) |
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 NodeEventContext::~NodeEventContext() | 45 NodeEventContext::~NodeEventContext() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 void NodeEventContext::trace(Visitor* visitor) | 49 void NodeEventContext::trace(Visitor* visitor) |
50 { | 50 { |
51 visitor->trace(m_node); | 51 visitor->trace(m_node); |
| 52 visitor->trace(m_currentTarget); |
52 } | 53 } |
53 | 54 |
54 void NodeEventContext::handleLocalEvents(Event* event) const | 55 void NodeEventContext::handleLocalEvents(Event* event) const |
55 { | 56 { |
56 if (touchEventContext()) { | 57 if (touchEventContext()) { |
57 touchEventContext()->handleLocalEvents(event); | 58 touchEventContext()->handleLocalEvents(event); |
58 } else if (relatedTarget()) { | 59 } else if (relatedTarget()) { |
59 if (event->isMouseEvent()) { | 60 if (event->isMouseEvent()) { |
60 toMouseEvent(event)->setRelatedTarget(relatedTarget()); | 61 toMouseEvent(event)->setRelatedTarget(relatedTarget()); |
61 } else if (event->isFocusEvent()) { | 62 } else if (event->isFocusEvent()) { |
62 toFocusEvent(event)->setRelatedTarget(relatedTarget()); | 63 toFocusEvent(event)->setRelatedTarget(relatedTarget()); |
63 } | 64 } |
64 } | 65 } |
65 event->setTarget(target()); | 66 event->setTarget(target()); |
66 event->setCurrentTarget(m_currentTarget.get()); | 67 event->setCurrentTarget(m_currentTarget.get()); |
67 m_node->handleLocalEvents(event); | 68 m_node->handleLocalEvents(event); |
68 } | 69 } |
69 | 70 |
70 } | 71 } |
OLD | NEW |