| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/input/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
| 6 | 6 |
| 7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
| 8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 // is on a mouse press. The problem is the <embed> node only starts | 711 // is on a mouse press. The problem is the <embed> node only starts |
| 712 // capturing mouse events *after* m_mousePressed for the containing frame | 712 // capturing mouse events *after* m_mousePressed for the containing frame |
| 713 // has already been set to true. As a result, the frame's EventHandler | 713 // has already been set to true. As a result, the frame's EventHandler |
| 714 // never sees the mouse release event, which is supposed to reset | 714 // never sees the mouse release event, which is supposed to reset |
| 715 // m_mousePressed... so m_mousePressed ends up remaining true until the | 715 // m_mousePressed... so m_mousePressed ends up remaining true until the |
| 716 // event handler finally gets another mouse released event. Oops. | 716 // event handler finally gets another mouse released event. Oops. |
| 717 // 2. Dragging doesn't start until after a mouse press event, but a drag | 717 // 2. Dragging doesn't start until after a mouse press event, but a drag |
| 718 // that ends as a result of a mouse release does not send a mouse release | 718 // that ends as a result of a mouse release does not send a mouse release |
| 719 // event. As a result, m_mousePressed also ends up remaining true until | 719 // event. As a result, m_mousePressed also ends up remaining true until |
| 720 // the next mouse release event seen by the EventHandler. | 720 // the next mouse release event seen by the EventHandler. |
| 721 if (event.Event().button != WebPointerProperties::Button::kLeft) | 721 // 3. When pressing Esc key while dragging and the object is outside of the |
| 722 // we get a mouse leave event here |
| 723 if (event.Event().button != WebPointerProperties::Button::kLeft || |
| 724 event.Event().GetType() == WebInputEvent::kMouseLeave) |
| 722 mouse_pressed_ = false; | 725 mouse_pressed_ = false; |
| 723 | 726 |
| 724 if (!mouse_pressed_) | 727 if (!mouse_pressed_) |
| 725 return WebInputEventResult::kNotHandled; | 728 return WebInputEventResult::kNotHandled; |
| 726 | 729 |
| 727 if (HandleDrag(event, DragInitiator::kMouse)) | 730 if (HandleDrag(event, DragInitiator::kMouse)) |
| 728 return WebInputEventResult::kHandledSystem; | 731 return WebInputEventResult::kHandledSystem; |
| 729 | 732 |
| 730 Node* target_node = event.InnerNode(); | 733 Node* target_node = event.InnerNode(); |
| 731 if (!target_node) | 734 if (!target_node) |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 | 1053 |
| 1051 void MouseEventManager::SetClickCount(int click_count) { | 1054 void MouseEventManager::SetClickCount(int click_count) { |
| 1052 click_count_ = click_count; | 1055 click_count_ = click_count; |
| 1053 } | 1056 } |
| 1054 | 1057 |
| 1055 bool MouseEventManager::MouseDownMayStartDrag() { | 1058 bool MouseEventManager::MouseDownMayStartDrag() { |
| 1056 return mouse_down_may_start_drag_; | 1059 return mouse_down_may_start_drag_; |
| 1057 } | 1060 } |
| 1058 | 1061 |
| 1059 } // namespace blink | 1062 } // namespace blink |
| OLD | NEW |