| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/events/NodeEventContext.h" | 27 #include "core/events/NodeEventContext.h" |
| 28 | 28 |
| 29 #include "core/dom/TouchList.h" | 29 #include "core/dom/TouchList.h" |
| 30 #include "core/events/Event.h" | 30 #include "core/events/Event.h" |
| 31 #include "core/events/FocusEvent.h" | 31 #include "core/events/FocusEvent.h" |
| 32 #include "core/events/MouseEvent.h" | 32 #include "core/events/MouseEvent.h" |
| 33 #include "core/events/PointerEvent.h" |
| 33 #include "core/events/TouchEventContext.h" | 34 #include "core/events/TouchEventContext.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 NodeEventContext::NodeEventContext(Node* node, EventTarget* currentTarget) | 38 NodeEventContext::NodeEventContext(Node* node, EventTarget* currentTarget) |
| 38 : m_node(node), m_currentTarget(currentTarget) { | 39 : m_node(node), m_currentTarget(currentTarget) { |
| 39 DCHECK(m_node); | 40 DCHECK(m_node); |
| 40 } | 41 } |
| 41 | 42 |
| 42 DEFINE_TRACE(NodeEventContext) { | 43 DEFINE_TRACE(NodeEventContext) { |
| 43 visitor->trace(m_node); | 44 visitor->trace(m_node); |
| 44 visitor->trace(m_currentTarget); | 45 visitor->trace(m_currentTarget); |
| 45 visitor->trace(m_treeScopeEventContext); | 46 visitor->trace(m_treeScopeEventContext); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void NodeEventContext::handleLocalEvents(Event& event) const { | 49 void NodeEventContext::handleLocalEvents(Event& event) const { |
| 49 if (TouchEventContext* touchContext = touchEventContext()) { | 50 if (TouchEventContext* touchContext = touchEventContext()) { |
| 50 touchContext->handleLocalEvents(event); | 51 touchContext->handleLocalEvents(event); |
| 51 } else if (relatedTarget()) { | 52 } else if (relatedTarget()) { |
| 52 if (event.isMouseEvent()) { | 53 if (event.isMouseEvent()) { |
| 53 toMouseEvent(event).setRelatedTarget(relatedTarget()); | 54 toMouseEvent(event).setRelatedTarget(relatedTarget()); |
| 55 } else if (event.isPointerEvent()) { |
| 56 toPointerEvent(event).setRelatedTarget(relatedTarget()); |
| 54 } else if (event.isFocusEvent()) { | 57 } else if (event.isFocusEvent()) { |
| 55 toFocusEvent(event).setRelatedTarget(relatedTarget()); | 58 toFocusEvent(event).setRelatedTarget(relatedTarget()); |
| 56 } | 59 } |
| 57 } | 60 } |
| 58 event.setTarget(target()); | 61 event.setTarget(target()); |
| 59 event.setCurrentTarget(m_currentTarget.get()); | 62 event.setCurrentTarget(m_currentTarget.get()); |
| 60 m_node->handleLocalEvents(event); | 63 m_node->handleLocalEvents(event); |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |