| 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 "content/shell/test_runner/event_sender.h" | 5 #include "content/shell/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 void GesturePinchUpdate(gin::Arguments* args); | 609 void GesturePinchUpdate(gin::Arguments* args); |
| 610 void GestureTap(gin::Arguments* args); | 610 void GestureTap(gin::Arguments* args); |
| 611 void GestureTapDown(gin::Arguments* args); | 611 void GestureTapDown(gin::Arguments* args); |
| 612 void GestureShowPress(gin::Arguments* args); | 612 void GestureShowPress(gin::Arguments* args); |
| 613 void GestureTapCancel(gin::Arguments* args); | 613 void GestureTapCancel(gin::Arguments* args); |
| 614 void GestureLongPress(gin::Arguments* args); | 614 void GestureLongPress(gin::Arguments* args); |
| 615 void GestureLongTap(gin::Arguments* args); | 615 void GestureLongTap(gin::Arguments* args); |
| 616 void GestureTwoFingerTap(gin::Arguments* args); | 616 void GestureTwoFingerTap(gin::Arguments* args); |
| 617 void ContinuousMouseScrollBy(gin::Arguments* args); | 617 void ContinuousMouseScrollBy(gin::Arguments* args); |
| 618 void MouseMoveTo(gin::Arguments* args); | 618 void MouseMoveTo(gin::Arguments* args); |
| 619 void MouseLeave(); | 619 void MouseLeave(gin::Arguments* args); |
| 620 void MouseScrollBy(gin::Arguments* args); | 620 void MouseScrollBy(gin::Arguments* args); |
| 621 void ScheduleAsynchronousClick(gin::Arguments* args); | 621 void ScheduleAsynchronousClick(gin::Arguments* args); |
| 622 void ScheduleAsynchronousKeyDown(gin::Arguments* args); | 622 void ScheduleAsynchronousKeyDown(gin::Arguments* args); |
| 623 void MouseDown(gin::Arguments* args); | 623 void MouseDown(gin::Arguments* args); |
| 624 void MouseUp(gin::Arguments* args); | 624 void MouseUp(gin::Arguments* args); |
| 625 void SetMouseButtonState(gin::Arguments* args); | 625 void SetMouseButtonState(gin::Arguments* args); |
| 626 void KeyDown(gin::Arguments* args); | 626 void KeyDown(gin::Arguments* args); |
| 627 | 627 |
| 628 // Binding properties: | 628 // Binding properties: |
| 629 bool ForceLayoutOnEvents() const; | 629 bool ForceLayoutOnEvents() const; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { | 1008 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { |
| 1009 if (sender_) | 1009 if (sender_) |
| 1010 sender_->MouseScrollBy(args, EventSender::MouseScrollType::PIXEL); | 1010 sender_->MouseScrollBy(args, EventSender::MouseScrollType::PIXEL); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { | 1013 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { |
| 1014 if (sender_) | 1014 if (sender_) |
| 1015 sender_->MouseMoveTo(args); | 1015 sender_->MouseMoveTo(args); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 void EventSenderBindings::MouseLeave() { | 1018 void EventSenderBindings::MouseLeave(gin::Arguments* args) { |
| 1019 if (sender_) | 1019 if (!sender_) |
| 1020 sender_->MouseLeave(); | 1020 return; |
| 1021 |
| 1022 WebPointerProperties::PointerType pointerType = |
| 1023 WebPointerProperties::PointerType::kMouse; |
| 1024 int pointerId = kRawMousePointerId; |
| 1025 |
| 1026 // Only allow pen or mouse through this API. |
| 1027 if (!getPointerType(args, false, pointerType)) |
| 1028 return; |
| 1029 if (!args->PeekNext().IsEmpty()) { |
| 1030 if (!args->GetNext(&pointerId)) { |
| 1031 args->ThrowError(); |
| 1032 return; |
| 1033 } |
| 1034 } |
| 1035 sender_->MouseLeave(pointerType, pointerId); |
| 1021 } | 1036 } |
| 1022 | 1037 |
| 1023 void EventSenderBindings::MouseScrollBy(gin::Arguments* args) { | 1038 void EventSenderBindings::MouseScrollBy(gin::Arguments* args) { |
| 1024 if (sender_) | 1039 if (sender_) |
| 1025 sender_->MouseScrollBy(args, EventSender::MouseScrollType::TICK); | 1040 sender_->MouseScrollBy(args, EventSender::MouseScrollType::TICK); |
| 1026 } | 1041 } |
| 1027 | 1042 |
| 1028 void EventSenderBindings::ScheduleAsynchronousClick(gin::Arguments* args) { | 1043 void EventSenderBindings::ScheduleAsynchronousClick(gin::Arguments* args) { |
| 1029 if (!sender_) | 1044 if (!sender_) |
| 1030 return; | 1045 return; |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 InitMouseEventGeneric( | 2219 InitMouseEventGeneric( |
| 2205 current_pointer_state_[kRawMousePointerId].pressed_button_, | 2220 current_pointer_state_[kRawMousePointerId].pressed_button_, |
| 2206 current_pointer_state_[kRawMousePointerId].current_buttons_, mouse_pos, | 2221 current_pointer_state_[kRawMousePointerId].current_buttons_, mouse_pos, |
| 2207 click_count, pointerType, pointerId, pressure, tiltX, tiltY, &event); | 2222 click_count, pointerType, pointerId, pressure, tiltX, tiltY, &event); |
| 2208 HandleInputEventOnViewOrPopup(event); | 2223 HandleInputEventOnViewOrPopup(event); |
| 2209 if (pointerType == WebPointerProperties::PointerType::kMouse) | 2224 if (pointerType == WebPointerProperties::PointerType::kMouse) |
| 2210 DoDragAfterMouseMove(event); | 2225 DoDragAfterMouseMove(event); |
| 2211 } | 2226 } |
| 2212 } | 2227 } |
| 2213 | 2228 |
| 2214 void EventSender::MouseLeave() { | 2229 void EventSender::MouseLeave( |
| 2230 blink::WebPointerProperties::PointerType pointerType, |
| 2231 int pointerId) { |
| 2215 if (force_layout_on_events_) | 2232 if (force_layout_on_events_) |
| 2216 widget()->UpdateAllLifecyclePhases(); | 2233 widget()->UpdateAllLifecyclePhases(); |
| 2217 | 2234 |
| 2218 WebMouseEvent event(WebInputEvent::kMouseLeave, | 2235 WebMouseEvent event(WebInputEvent::kMouseLeave, |
| 2219 ModifiersForPointer(kRawMousePointerId), | 2236 ModifiersForPointer(pointerId), GetCurrentEventTimeSec()); |
| 2220 GetCurrentEventTimeSec()); | 2237 InitMouseEventGeneric(WebMouseEvent::Button::kNoButton, 0, |
| 2221 InitMouseEvent(WebMouseEvent::Button::kNoButton, 0, | 2238 current_pointer_state_[kRawMousePointerId].last_pos_, |
| 2222 current_pointer_state_[kRawMousePointerId].last_pos_, | 2239 click_count_, pointerType, pointerId, 0.0, 0, 0, |
| 2223 click_count_, &event); | 2240 &event); |
| 2224 HandleInputEventOnViewOrPopup(event); | 2241 HandleInputEventOnViewOrPopup(event); |
| 2225 } | 2242 } |
| 2226 | 2243 |
| 2227 void EventSender::ScheduleAsynchronousClick(int button_number, int modifiers) { | 2244 void EventSender::ScheduleAsynchronousClick(int button_number, int modifiers) { |
| 2228 delegate()->PostTask(base::Bind(&EventSender::MouseDown, | 2245 delegate()->PostTask(base::Bind(&EventSender::MouseDown, |
| 2229 weak_factory_.GetWeakPtr(), button_number, | 2246 weak_factory_.GetWeakPtr(), button_number, |
| 2230 modifiers)); | 2247 modifiers)); |
| 2231 delegate()->PostTask(base::Bind(&EventSender::MouseUp, | 2248 delegate()->PostTask(base::Bind(&EventSender::MouseUp, |
| 2232 weak_factory_.GetWeakPtr(), button_number, | 2249 weak_factory_.GetWeakPtr(), button_number, |
| 2233 modifiers)); | 2250 modifiers)); |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2900 return view()->MainFrame()->ToWebLocalFrame()->FrameWidget(); | 2917 return view()->MainFrame()->ToWebLocalFrame()->FrameWidget(); |
| 2901 } | 2918 } |
| 2902 | 2919 |
| 2903 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates( | 2920 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates( |
| 2904 const WebInputEvent& event) { | 2921 const WebInputEvent& event) { |
| 2905 return delegate()->TransformScreenToWidgetCoordinates( | 2922 return delegate()->TransformScreenToWidgetCoordinates( |
| 2906 web_widget_test_proxy_base_, event); | 2923 web_widget_test_proxy_base_, event); |
| 2907 } | 2924 } |
| 2908 | 2925 |
| 2909 } // namespace test_runner | 2926 } // namespace test_runner |
| OLD | NEW |