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

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: Improve MainThreadEventQueue unittests 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/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 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 last_event_timestamp_ = raw_event.timeStampSeconds(); 2799 last_event_timestamp_ = raw_event.timeStampSeconds();
2800 2800
2801 WebPagePopup* popup = widget()->pagePopup(); 2801 WebPagePopup* popup = widget()->pagePopup();
2802 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type())) { 2802 if (popup && !WebInputEvent::isKeyboardEventType(raw_event.type())) {
2803 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the 2803 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the
2804 // event does not have to be converted. 2804 // event does not have to be converted.
2805 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent( 2805 std::unique_ptr<WebInputEvent> scaled_event = ui::ScaleWebInputEvent(
2806 raw_event, delegate()->GetWindowToViewportScale()); 2806 raw_event, delegate()->GetWindowToViewportScale());
2807 const WebInputEvent* popup_friendly_event = 2807 const WebInputEvent* popup_friendly_event =
2808 scaled_event.get() ? scaled_event.get() : &raw_event; 2808 scaled_event.get() ? scaled_event.get() : &raw_event;
2809 return popup->handleInputEvent(*popup_friendly_event); 2809 return popup->handleInputEvent(
2810 blink::WebCoalescedInputEvent(*popup_friendly_event));
2810 } 2811 }
2811 2812
2812 std::unique_ptr<WebInputEvent> widget_event = 2813 std::unique_ptr<WebInputEvent> widget_event =
2813 TransformScreenToWidgetCoordinates(raw_event); 2814 TransformScreenToWidgetCoordinates(raw_event);
2814 const WebInputEvent* event = 2815 const WebInputEvent* event =
2815 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get()) 2816 widget_event.get() ? static_cast<WebMouseEvent*>(widget_event.get())
2816 : &raw_event; 2817 : &raw_event;
2817 return widget()->handleInputEvent(*event); 2818 return widget()->handleInputEvent(blink::WebCoalescedInputEvent(*event));
dtapuska 2017/01/13 18:56:23 Does it not make sense here to adjust TranslateAnd
Navid Zolghadr 2017/01/13 19:02:10 I have done the modification to the generator func
dtapuska 2017/01/13 19:10:22 Ugh; I had clicked on it; but it is used in a numb
2818 } 2819 }
2819 2820
2820 void EventSender::SendGesturesForMouseWheelEvent( 2821 void EventSender::SendGesturesForMouseWheelEvent(
2821 const WebMouseWheelEvent wheel_event) { 2822 const WebMouseWheelEvent wheel_event) {
2822 WebGestureEvent begin_event(WebInputEvent::GestureScrollBegin, 2823 WebGestureEvent begin_event(WebInputEvent::GestureScrollBegin,
2823 wheel_event.modifiers(), 2824 wheel_event.modifiers(),
2824 GetCurrentEventTimeSec()); 2825 GetCurrentEventTimeSec());
2825 InitGestureEventFromMouseWheel(wheel_event, &begin_event); 2826 InitGestureEventFromMouseWheel(wheel_event, &begin_event);
2826 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX; 2827 begin_event.data.scrollBegin.deltaXHint = wheel_event.deltaX;
2827 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY; 2828 begin_event.data.scrollBegin.deltaYHint = wheel_event.deltaY;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 return view()->mainFrame()->toWebLocalFrame()->frameWidget(); 2899 return view()->mainFrame()->toWebLocalFrame()->frameWidget();
2899 } 2900 }
2900 2901
2901 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates( 2902 std::unique_ptr<WebInputEvent> EventSender::TransformScreenToWidgetCoordinates(
2902 const WebInputEvent& event) { 2903 const WebInputEvent& event) {
2903 return delegate()->TransformScreenToWidgetCoordinates( 2904 return delegate()->TransformScreenToWidgetCoordinates(
2904 web_widget_test_proxy_base_, event); 2905 web_widget_test_proxy_base_, event);
2905 } 2906 }
2906 2907
2907 } // namespace test_runner 2908 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698