| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/frame/NewEventHandler.h" | 6 #include "sky/engine/core/frame/NewEventHandler.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/dom/Document.h" | 8 #include "sky/engine/core/dom/Document.h" |
| 9 #include "sky/engine/core/dom/NodeRenderingTraversal.h" | 9 #include "sky/engine/core/dom/NodeRenderingTraversal.h" |
| 10 #include "sky/engine/core/editing/Editor.h" | 10 #include "sky/engine/core/editing/Editor.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 NewEventHandler::~NewEventHandler() | 48 NewEventHandler::~NewEventHandler() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 Node* NewEventHandler::targetForKeyboardEvent() const | 52 Node* NewEventHandler::targetForKeyboardEvent() const |
| 53 { | 53 { |
| 54 Document* document = m_frame.document(); | 54 Document* document = m_frame.document(); |
| 55 if (Node* focusedElement = document->focusedElement()) | 55 if (Node* focusedElement = document->focusedElement()) |
| 56 return focusedElement; | 56 return focusedElement; |
| 57 return document->documentElement(); | 57 return document; |
| 58 } | 58 } |
| 59 | 59 |
| 60 Node* NewEventHandler::targetForHitTestResult(const HitTestResult& hitTestResult
) | 60 Node* NewEventHandler::targetForHitTestResult(const HitTestResult& hitTestResult
) |
| 61 { | 61 { |
| 62 Node* node = hitTestResult.innerNode(); | 62 Node* node = hitTestResult.innerNode(); |
| 63 if (!node) | 63 if (!node) |
| 64 return m_frame.document()->documentElement(); | 64 return m_frame.document(); |
| 65 if (node->isTextNode()) | 65 if (node->isTextNode()) |
| 66 return NodeRenderingTraversal::parent(node); | 66 return NodeRenderingTraversal::parent(node); |
| 67 return node; | 67 return node; |
| 68 } | 68 } |
| 69 | 69 |
| 70 HitTestResult NewEventHandler::performHitTest(const LayoutPoint& point) | 70 HitTestResult NewEventHandler::performHitTest(const LayoutPoint& point) |
| 71 { | 71 { |
| 72 HitTestResult result(point); | 72 HitTestResult result(point); |
| 73 if (!m_frame.contentRenderer()) | 73 if (!m_frame.contentRenderer()) |
| 74 return result; | 74 return result; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 auto it = m_stateForPointer.find(event.pointer); | 244 auto it = m_stateForPointer.find(event.pointer); |
| 245 if (it == m_stateForPointer.end()) | 245 if (it == m_stateForPointer.end()) |
| 246 return false; | 246 return false; |
| 247 PointerState stateCopy = it->second; | 247 PointerState stateCopy = it->second; |
| 248 m_stateForPointer.erase(it); | 248 m_stateForPointer.erase(it); |
| 249 ASSERT(stateCopy.target); | 249 ASSERT(stateCopy.target); |
| 250 return dispatchPointerEvent(stateCopy, event); | 250 return dispatchPointerEvent(stateCopy, event); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } | 253 } |
| OLD | NEW |