Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: components/test_runner/event_sender.cc

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Creating CoalescedWebInputEvent Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "components/test_runner/mock_spell_check.h" 21 #include "components/test_runner/mock_spell_check.h"
22 #include "components/test_runner/test_interfaces.h" 22 #include "components/test_runner/test_interfaces.h"
23 #include "components/test_runner/web_test_delegate.h" 23 #include "components/test_runner/web_test_delegate.h"
24 #include "components/test_runner/web_view_test_proxy.h" 24 #include "components/test_runner/web_view_test_proxy.h"
25 #include "components/test_runner/web_widget_test_proxy.h" 25 #include "components/test_runner/web_widget_test_proxy.h"
26 #include "gin/handle.h" 26 #include "gin/handle.h"
27 #include "gin/object_template_builder.h" 27 #include "gin/object_template_builder.h"
28 #include "gin/wrappable.h" 28 #include "gin/wrappable.h"
29 #include "third_party/WebKit/public/platform/CoalescedWebInputEvent.h"
29 #include "third_party/WebKit/public/platform/WebGestureEvent.h" 30 #include "third_party/WebKit/public/platform/WebGestureEvent.h"
30 #include "third_party/WebKit/public/platform/WebInputEvent.h"
31 #include "third_party/WebKit/public/platform/WebPointerProperties.h" 31 #include "third_party/WebKit/public/platform/WebPointerProperties.h"
32 #include "third_party/WebKit/public/platform/WebString.h" 32 #include "third_party/WebKit/public/platform/WebString.h"
33 #include "third_party/WebKit/public/platform/WebVector.h" 33 #include "third_party/WebKit/public/platform/WebVector.h"
34 #include "third_party/WebKit/public/web/WebContextMenuData.h" 34 #include "third_party/WebKit/public/web/WebContextMenuData.h"
35 #include "third_party/WebKit/public/web/WebFrameWidget.h" 35 #include "third_party/WebKit/public/web/WebFrameWidget.h"
36 #include "third_party/WebKit/public/web/WebKit.h" 36 #include "third_party/WebKit/public/web/WebKit.h"
37 #include "third_party/WebKit/public/web/WebLocalFrame.h" 37 #include "third_party/WebKit/public/web/WebLocalFrame.h"
38 #include "third_party/WebKit/public/web/WebPagePopup.h" 38 #include "third_party/WebKit/public/web/WebPagePopup.h"
39 #include "third_party/WebKit/public/web/WebView.h" 39 #include "third_party/WebKit/public/web/WebView.h"
40 #include "ui/events/blink/blink_event_util.h" 40 #include "ui/events/blink/blink_event_util.h"
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 last_event_timestamp_ = raw_event.timeStampSeconds; 2803 last_event_timestamp_ = raw_event.timeStampSeconds;
2804 2804
2805 WebPagePopup* popup = widget()->pagePopup(); 2805 WebPagePopup* popup = widget()->pagePopup();
2806 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type)) { 2806 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type)) {
2807 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the 2807 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the
2808 // event does not have to be converted. 2808 // event does not have to be converted.
2809 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent( 2809 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent(
2810 raw_event, delegate()->GetWindowToViewportScale()); 2810 raw_event, delegate()->GetWindowToViewportScale());
2811 const WebInputEvent* popup_friendly_event = 2811 const WebInputEvent* popup_friendly_event =
2812 scaled_event.get() ? scaled_event.get() : &raw_event; 2812 scaled_event.get() ? scaled_event.get() : &raw_event;
2813 return popup->handleInputEvent(*popup_friendly_event); 2813 return popup->handleInputEvent(
2814 CoalescedWebInputEvent(popup_friendly_event));
2814 } 2815 }
2815 2816
2816 std::unique_ptr<WebInputEvent> widget_event = 2817 std::unique_ptr<WebInputEvent> widget_event =
2817 TransformScreenToWidgetCoordinates(raw_event); 2818 TransformScreenToWidgetCoordinates(raw_event);
2818 const WebInputEvent* event = 2819 const WebInputEvent* event =
2819 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get()) 2820 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get())
2820 : &raw_event; 2821 : &raw_event;
2821 return widget()->handleInputEvent(*event); 2822 return widget()->handleInputEvent(CoalescedWebInputEvent(*event));
2822 } 2823 }
2823 2824
2824 void EventSender::SendGesturesForMouseWheelEvent( 2825 void EventSender::SendGesturesForMouseWheelEvent(
2825 const WebMouseWheelEvent wheel_event) { 2826 const WebMouseWheelEvent wheel_event) {
2826 WebGestureEvent begin_event; 2827 WebGestureEvent begin_event;
2827 InitGestureEventFromMouseWheel(WebInputEvent::GestureScrollBegin, 2828 InitGestureEventFromMouseWheel(WebInputEvent::GestureScrollBegin,
2828 GetCurrentEventTimeSec(), wheel_event, 2829 GetCurrentEventTimeSec(), wheel_event,
2829 &begin_event); 2830 &begin_event);
2830 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX; 2831 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX;
2831 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY; 2832 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 return view()->mainFrame()->toWebLocalFrame()->frameWidget(); 2904 return view()->mainFrame()->toWebLocalFrame()->frameWidget();
2904 } 2905 }
2905 2906
2906 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates( 2907 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates(
2907 const WebInputEvent& event) { 2908 const WebInputEvent& event) {
2908 return delegate()->TransformScreenToWidgetCoordinates( 2909 return delegate()->TransformScreenToWidgetCoordinates(
2909 web_widget_test_proxy_base_, event); 2910 web_widget_test_proxy_base_, event);
2910 } 2911 }
2911 2912
2912 } // namespace test_runner 2913 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698