| 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 "sky/engine/config.h" | 27 #include "sky/engine/config.h" |
| 28 #include "sky/engine/core/events/NodeEventContext.h" | 28 #include "sky/engine/core/events/NodeEventContext.h" |
| 29 | 29 |
| 30 #include "sky/engine/core/dom/TouchList.h" | 30 #include "sky/engine/core/dom/TouchList.h" |
| 31 #include "sky/engine/core/events/Event.h" | 31 #include "sky/engine/core/events/Event.h" |
| 32 #include "sky/engine/core/events/FocusEvent.h" | 32 #include "sky/engine/core/events/FocusEvent.h" |
| 33 #include "sky/engine/core/events/MouseEvent.h" | |
| 34 #include "sky/engine/core/events/TouchEventContext.h" | 33 #include "sky/engine/core/events/TouchEventContext.h" |
| 35 | 34 |
| 36 namespace blink { | 35 namespace blink { |
| 37 | 36 |
| 38 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NodeEventContext) | 37 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NodeEventContext) |
| 39 | 38 |
| 40 NodeEventContext::NodeEventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget
> currentTarget) | 39 NodeEventContext::NodeEventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget
> currentTarget) |
| 41 : m_node(node) | 40 : m_node(node) |
| 42 , m_currentTarget(currentTarget) | 41 , m_currentTarget(currentTarget) |
| 43 { | 42 { |
| 44 ASSERT(m_node); | 43 ASSERT(m_node); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void NodeEventContext::handleLocalEvents(Event* event) const | 46 void NodeEventContext::handleLocalEvents(Event* event) const |
| 48 { | 47 { |
| 49 if (touchEventContext()) { | 48 if (touchEventContext()) { |
| 50 touchEventContext()->handleLocalEvents(event); | 49 touchEventContext()->handleLocalEvents(event); |
| 51 } else if (relatedTarget()) { | 50 } else if (relatedTarget()) { |
| 52 if (event->isMouseEvent()) { | 51 if (event->isFocusEvent()) |
| 53 toMouseEvent(event)->setRelatedTarget(relatedTarget()); | |
| 54 } else if (event->isFocusEvent()) { | |
| 55 toFocusEvent(event)->setRelatedTarget(relatedTarget()); | 52 toFocusEvent(event)->setRelatedTarget(relatedTarget()); |
| 56 } | |
| 57 } | 53 } |
| 58 event->setTarget(target()); | 54 event->setTarget(target()); |
| 59 event->setCurrentTarget(m_currentTarget.get()); | 55 event->setCurrentTarget(m_currentTarget.get()); |
| 60 m_node->handleLocalEvents(event); | 56 m_node->handleLocalEvents(event); |
| 61 } | 57 } |
| 62 | 58 |
| 63 } | 59 } |
| OLD | NEW |