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

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

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Rebase Created 3 years, 11 months 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/WebCoalescedInputEvent.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/WebKeyboardEvent.h" 31 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h"
32 #include "third_party/WebKit/public/platform/WebPointerProperties.h" 32 #include "third_party/WebKit/public/platform/WebPointerProperties.h"
33 #include "third_party/WebKit/public/platform/WebString.h" 33 #include "third_party/WebKit/public/platform/WebString.h"
34 #include "third_party/WebKit/public/platform/WebTouchEvent.h" 34 #include "third_party/WebKit/public/platform/WebTouchEvent.h"
35 #include "third_party/WebKit/public/platform/WebVector.h" 35 #include "third_party/WebKit/public/platform/WebVector.h"
36 #include "third_party/WebKit/public/web/WebContextMenuData.h" 36 #include "third_party/WebKit/public/web/WebContextMenuData.h"
37 #include "third_party/WebKit/public/web/WebFrameWidget.h" 37 #include "third_party/WebKit/public/web/WebFrameWidget.h"
38 #include "third_party/WebKit/public/web/WebKit.h" 38 #include "third_party/WebKit/public/web/WebKit.h"
39 #include "third_party/WebKit/public/web/WebLocalFrame.h" 39 #include "third_party/WebKit/public/web/WebLocalFrame.h"
40 #include "third_party/WebKit/public/web/WebPagePopup.h" 40 #include "third_party/WebKit/public/web/WebPagePopup.h"
(...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 last_event_timestamp_ = raw_event.timeStampSeconds(); 2801 last_event_timestamp_ = raw_event.timeStampSeconds();
2802 2802
2803 WebPagePopup* popup = widget()->pagePopup(); 2803 WebPagePopup* popup = widget()->pagePopup();
2804 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type())) { 2804 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type())) {
2805 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the 2805 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the
2806 // event does not have to be converted. 2806 // event does not have to be converted.
2807 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent( 2807 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent(
2808 raw_event, delegate()->GetWindowToViewportScale()); 2808 raw_event, delegate()->GetWindowToViewportScale());
2809 const WebInputEvent* popup_friendly_event = 2809 const WebInputEvent* popup_friendly_event =
2810 scaled_event.get() ? scaled_event.get() : &raw_event; 2810 scaled_event.get() ? scaled_event.get() : &raw_event;
2811 return popup->handleInputEvent(*popup_friendly_event); 2811 return popup->handleInputEvent(
2812 blink::WebCoalescedInputEvent(*popup_friendly_event));
2812 } 2813 }
2813 2814
2814 std::unique_ptr<WebInputEvent> widget_event = 2815 std::unique_ptr<WebInputEvent> widget_event =
2815 TransformScreenToWidgetCoordinates(raw_event); 2816 TransformScreenToWidgetCoordinates(raw_event);
2816 const WebInputEvent* event = 2817 const WebInputEvent* event =
2817 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get()) 2818 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get())
2818 : &raw_event; 2819 : &raw_event;
2819 return widget()->handleInputEvent(*event); 2820 return widget()->handleInputEvent(blink::WebCoalescedInputEvent(*event));
2820 } 2821 }
2821 2822
2822 void EventSender::SendGesturesForMouseWheelEvent( 2823 void EventSender::SendGesturesForMouseWheelEvent(
2823 const WebMouseWheelEvent wheel_event) { 2824 const WebMouseWheelEvent wheel_event) {
2824 WebGestureEvent begin_event(WebInputEvent::GestureScrollBegin, 2825 WebGestureEvent begin_event(WebInputEvent::GestureScrollBegin,
2825 wheel_event.modifiers(), 2826 wheel_event.modifiers(),
2826 GetCurrentEventTimeSec()); 2827 GetCurrentEventTimeSec());
2827 InitGestureEventFromMouseWheel(wheel_event, &begin_event); 2828 InitGestureEventFromMouseWheel(wheel_event, &begin_event);
2828 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX; 2829 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX;
2829 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY; 2830 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 return view()->mainFrame()->toWebLocalFrame()->frameWidget(); 2901 return view()->mainFrame()->toWebLocalFrame()->frameWidget();
2901 } 2902 }
2902 2903
2903 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates( 2904 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates(
2904 const WebInputEvent& event) { 2905 const WebInputEvent& event) {
2905 return delegate()->TransformScreenToWidgetCoordinates( 2906 return delegate()->TransformScreenToWidgetCoordinates(
2906 web_widget_test_proxy_base_, event); 2907 web_widget_test_proxy_base_, event);
2907 } 2908 }
2908 2909
2909 } // namespace test_runner 2910 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/plugins/renderer/webview_plugin.cc ('k') | components/test_runner/text_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698