| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/event_sender.h" | 5 #include "components/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 WebPoint screen_point(event->globalX, event->globalY); | 2663 WebPoint screen_point(event->globalX, event->globalY); |
| 2664 current_drag_effect_ = drag_effect; | 2664 current_drag_effect_ = drag_effect; |
| 2665 if (current_drag_effect_) { | 2665 if (current_drag_effect_) { |
| 2666 // Specifically pass any keyboard modifiers to the drop method. This allows | 2666 // Specifically pass any keyboard modifiers to the drop method. This allows |
| 2667 // tests to control the drop type (i.e. copy or move). | 2667 // tests to control the drop type (i.e. copy or move). |
| 2668 view()->dragTargetDrop(current_drag_data_, client_point, screen_point, | 2668 view()->dragTargetDrop(current_drag_data_, client_point, screen_point, |
| 2669 event->modifiers); | 2669 event->modifiers); |
| 2670 } else { | 2670 } else { |
| 2671 view()->dragTargetDragLeave(); | 2671 view()->dragTargetDragLeave(); |
| 2672 } | 2672 } |
| 2673 current_drag_data_.reset(); |
| 2673 view()->dragSourceEndedAt(client_point, screen_point, current_drag_effect_); | 2674 view()->dragSourceEndedAt(client_point, screen_point, current_drag_effect_); |
| 2674 view()->dragSourceSystemDragEnded(); | 2675 view()->dragSourceSystemDragEnded(); |
| 2675 | |
| 2676 current_drag_data_.reset(); | |
| 2677 } | 2676 } |
| 2678 | 2677 |
| 2679 void EventSender::DoDragAfterMouseUp(const WebMouseEvent& unscaled_event) { | 2678 void EventSender::DoDragAfterMouseUp(const WebMouseEvent& unscaled_event) { |
| 2680 std::unique_ptr<WebInputEvent> scaled_event = ScaleEvent(unscaled_event); | 2679 std::unique_ptr<WebInputEvent> scaled_event = ScaleEvent(unscaled_event); |
| 2681 const WebMouseEvent* event = | 2680 const WebMouseEvent* event = |
| 2682 scaled_event.get() ? static_cast<WebMouseEvent*>(scaled_event.get()) | 2681 scaled_event.get() ? static_cast<WebMouseEvent*>(scaled_event.get()) |
| 2683 : &unscaled_event; | 2682 : &unscaled_event; |
| 2684 | 2683 |
| 2685 last_click_time_sec_ = event->timeStampSeconds; | 2684 last_click_time_sec_ = event->timeStampSeconds; |
| 2686 last_click_pos_ = current_pointer_state_[kRawMousePointerId].last_pos_; | 2685 last_click_pos_ = current_pointer_state_[kRawMousePointerId].last_pos_; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 } | 2856 } |
| 2858 | 2857 |
| 2859 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( | 2858 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( |
| 2860 const WebInputEvent& event) { | 2859 const WebInputEvent& event) { |
| 2861 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event | 2860 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event |
| 2862 // does not have to be converted. | 2861 // does not have to be converted. |
| 2863 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); | 2862 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); |
| 2864 } | 2863 } |
| 2865 | 2864 |
| 2866 } // namespace test_runner | 2865 } // namespace test_runner |
| OLD | NEW |