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

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

Issue 2036873002: Making EventSender talk to the right WebWidget (for OOPIF support). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use RenderWidget::viewRect() [rather than windowRect()] in TransformScreenToWidgetCoordinates. Created 4 years, 2 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
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 5 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <unordered_map> 13 #include <unordered_map>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "third_party/WebKit/public/platform/WebDragData.h" 19 #include "third_party/WebKit/public/platform/WebDragData.h"
20 #include "third_party/WebKit/public/platform/WebDragOperation.h" 20 #include "third_party/WebKit/public/platform/WebDragOperation.h"
21 #include "third_party/WebKit/public/platform/WebInputEvent.h" 21 #include "third_party/WebKit/public/platform/WebInputEvent.h"
22 #include "third_party/WebKit/public/platform/WebInputEventResult.h" 22 #include "third_party/WebKit/public/platform/WebInputEventResult.h"
23 #include "third_party/WebKit/public/platform/WebPoint.h" 23 #include "third_party/WebKit/public/platform/WebPoint.h"
24 #include "third_party/WebKit/public/platform/WebTouchPoint.h" 24 #include "third_party/WebKit/public/platform/WebTouchPoint.h"
25 25
26 namespace blink { 26 namespace blink {
27 class WebLocalFrame; 27 class WebLocalFrame;
28 class WebView; 28 class WebView;
29 class WebWidget;
29 struct WebContextMenuData; 30 struct WebContextMenuData;
30 } 31 }
31 32
32 namespace gin { 33 namespace gin {
33 class Arguments; 34 class Arguments;
34 } 35 }
35 36
36 namespace test_runner { 37 namespace test_runner {
37 38
38 class TestInterfaces; 39 class TestInterfaces;
40 class WebWidgetTestProxyBase;
39 class WebTestDelegate; 41 class WebTestDelegate;
40 class WebViewTestProxyBase;
41 42
42 // Key event location code introduced in DOM Level 3. 43 // Key event location code introduced in DOM Level 3.
43 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents 44 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents
44 enum KeyLocationCode { 45 enum KeyLocationCode {
45 DOMKeyLocationStandard = 0x00, 46 DOMKeyLocationStandard = 0x00,
46 DOMKeyLocationLeft = 0x01, 47 DOMKeyLocationLeft = 0x01,
47 DOMKeyLocationRight = 0x02, 48 DOMKeyLocationRight = 0x02,
48 DOMKeyLocationNumpad = 0x03 49 DOMKeyLocationNumpad = 0x03
49 }; 50 };
50 51
51 class EventSender { 52 class EventSender {
52 public: 53 public:
53 explicit EventSender(WebViewTestProxyBase*); 54 explicit EventSender(WebWidgetTestProxyBase*);
54 virtual ~EventSender(); 55 virtual ~EventSender();
55 56
56 void Reset(); 57 void Reset();
57 void Install(blink::WebLocalFrame*); 58 void Install(blink::WebLocalFrame*);
58 59
59 void SetContextMenuData(const blink::WebContextMenuData&); 60 void SetContextMenuData(const blink::WebContextMenuData&);
60 61
61 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); 62 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask);
62 63
63 private: 64 private:
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 blink::WebPointerProperties* e, 194 blink::WebPointerProperties* e,
194 float* radius_x, 195 float* radius_x,
195 float* radius_y); 196 float* radius_y);
196 197
197 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); 198 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation);
198 199
199 void DoDragAfterMouseUp(const blink::WebMouseEvent&); 200 void DoDragAfterMouseUp(const blink::WebMouseEvent&);
200 void DoDragAfterMouseMove(const blink::WebMouseEvent&); 201 void DoDragAfterMouseMove(const blink::WebMouseEvent&);
201 void ReplaySavedEvents(); 202 void ReplaySavedEvents();
202 blink::WebInputEventResult HandleInputEventOnViewOrPopup( 203 blink::WebInputEventResult HandleInputEventOnViewOrPopup(
203 const blink::WebInputEvent&); 204 const blink::WebInputEvent& event);
204 205
205 void SendGesturesForMouseWheelEvent( 206 void SendGesturesForMouseWheelEvent(
206 const blink::WebMouseWheelEvent wheel_event); 207 const blink::WebMouseWheelEvent wheel_event);
207 208
208 std::unique_ptr<blink::WebInputEvent> ScaleEvent( 209 std::unique_ptr<blink::WebInputEvent> TransformScreenToWidgetCoordinates(
209 const blink::WebInputEvent& event); 210 const blink::WebInputEvent& event);
210 211
211 double last_event_timestamp() { return last_event_timestamp_; } 212 double last_event_timestamp() { return last_event_timestamp_; }
212 213
213 bool force_layout_on_events() const { return force_layout_on_events_; } 214 bool force_layout_on_events() const { return force_layout_on_events_; }
214 void set_force_layout_on_events(bool force) { 215 void set_force_layout_on_events(bool force) {
215 force_layout_on_events_ = force; 216 force_layout_on_events_ = force;
216 } 217 }
218 void DoLayoutIfForceLayoutOnEventsRequested();
217 219
218 bool is_drag_mode() const { return is_drag_mode_; } 220 bool is_drag_mode() const { return is_drag_mode_; }
219 void set_is_drag_mode(bool drag_mode) { is_drag_mode_ = drag_mode; } 221 void set_is_drag_mode(bool drag_mode) { is_drag_mode_ = drag_mode; }
220 222
221 #if defined(OS_WIN) 223 #if defined(OS_WIN)
222 int wm_key_down() const { return wm_key_down_; } 224 int wm_key_down() const { return wm_key_down_; }
223 void set_wm_key_down(int key_down) { wm_key_down_ = key_down; } 225 void set_wm_key_down(int key_down) { wm_key_down_ = key_down; }
224 226
225 int wm_key_up() const { return wm_key_up_; } 227 int wm_key_up() const { return wm_key_up_; }
226 void set_wm_key_up(int key_up) { wm_key_up_ = key_up; } 228 void set_wm_key_up(int key_up) { wm_key_up_ = key_up; }
(...skipping 23 matching lines...) Expand all
250 int wm_key_down_; 252 int wm_key_down_;
251 int wm_key_up_; 253 int wm_key_up_;
252 int wm_char_; 254 int wm_char_;
253 int wm_dead_char_; 255 int wm_dead_char_;
254 int wm_sys_key_down_; 256 int wm_sys_key_down_;
255 int wm_sys_key_up_; 257 int wm_sys_key_up_;
256 int wm_sys_char_; 258 int wm_sys_char_;
257 int wm_sys_dead_char_; 259 int wm_sys_dead_char_;
258 #endif 260 #endif
259 261
260 WebViewTestProxyBase* web_view_test_proxy_base_; 262 WebWidgetTestProxyBase* web_widget_test_proxy_base_;
261 TestInterfaces* interfaces(); 263 TestInterfaces* interfaces();
262 WebTestDelegate* delegate(); 264 WebTestDelegate* delegate();
263 const blink::WebView* view() const; 265 const blink::WebView* view() const;
264 blink::WebView* view(); 266 blink::WebView* view();
267 blink::WebWidget* widget();
265 268
266 bool force_layout_on_events_; 269 bool force_layout_on_events_;
267 270
268 // When set to true (the default value), we batch mouse move and mouse up 271 // When set to true (the default value), we batch mouse move and mouse up
269 // events so we can simulate drag & drop. 272 // events so we can simulate drag & drop.
270 bool is_drag_mode_; 273 bool is_drag_mode_;
271 274
272 int touch_modifiers_; 275 int touch_modifiers_;
273 bool touch_cancelable_; 276 bool touch_cancelable_;
274 std::vector<blink::WebTouchPoint> touch_points_; 277 std::vector<blink::WebTouchPoint> touch_points_;
275 278
276 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_; 279 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_;
277 280
278 blink::WebDragData current_drag_data_; 281 blink::WebDragData current_drag_data_;
279 282
280 // Location of the touch point that initiated a gesture. 283 // Location of the touch point that initiated a gesture.
281 blink::WebPoint current_gesture_location_; 284 blink::WebPoint current_gesture_location_;
282 285
283
284 // Mouse-like pointer properties. 286 // Mouse-like pointer properties.
285 struct PointerState { 287 struct PointerState {
286 // Last pressed button (Left/Right/Middle or None). 288 // Last pressed button (Left/Right/Middle or None).
287 blink::WebMouseEvent::Button pressed_button_; 289 blink::WebMouseEvent::Button pressed_button_;
288 290
289 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to 291 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to
290 // currently pressed buttons of the pointer (e.g. pen or mouse). 292 // currently pressed buttons of the pointer (e.g. pen or mouse).
291 int current_buttons_; 293 int current_buttons_;
292 294
293 // Location of last mouseMoveTo event of this pointer. 295 // Location of last mouseMoveTo event of this pointer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 double last_event_timestamp_; 328 double last_event_timestamp_;
327 329
328 base::WeakPtrFactory<EventSender> weak_factory_; 330 base::WeakPtrFactory<EventSender> weak_factory_;
329 331
330 DISALLOW_COPY_AND_ASSIGN(EventSender); 332 DISALLOW_COPY_AND_ASSIGN(EventSender);
331 }; 333 };
332 334
333 } // namespace test_runner 335 } // namespace test_runner
334 336
335 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 337 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698