| 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/browser/renderer_host/input/touch_emulator.h" | 5 #include "content/browser/renderer_host/input/touch_emulator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 shift_pressed_ = false; | 133 shift_pressed_ = false; |
| 134 SendKeyboardEvent(WebInputEvent::KeyUp); | 134 SendKeyboardEvent(WebInputEvent::KeyUp); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void SendMouseEvent(WebInputEvent::Type type, int x, int y) { | 137 void SendMouseEvent(WebInputEvent::Type type, int x, int y) { |
| 138 WebMouseEvent event(type, modifiers(), GetNextEventTimeSeconds()); | 138 WebMouseEvent event(type, modifiers(), GetNextEventTimeSeconds()); |
| 139 event.button = mouse_pressed_ ? WebMouseEvent::Button::Left : | 139 event.button = mouse_pressed_ ? WebMouseEvent::Button::Left : |
| 140 WebMouseEvent::Button::NoButton; | 140 WebMouseEvent::Button::NoButton; |
| 141 last_mouse_x_ = x; | 141 last_mouse_x_ = x; |
| 142 last_mouse_y_ = y; | 142 last_mouse_y_ = y; |
| 143 event.x = event.globalX = x; | 143 event.setPositionInWidget(x, y); |
| 144 event.y = event.globalY = y; | 144 event.setPositionInScreen(x, y); |
| 145 emulator()->HandleMouseEvent(event); | 145 emulator()->HandleMouseEvent(event); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool SendMouseWheelEvent() { | 148 bool SendMouseWheelEvent() { |
| 149 WebMouseWheelEvent event(WebInputEvent::MouseWheel, modifiers(), | 149 WebMouseWheelEvent event(WebInputEvent::MouseWheel, modifiers(), |
| 150 GetNextEventTimeSeconds()); | 150 GetNextEventTimeSeconds()); |
| 151 // Return whether mouse wheel is forwarded. | 151 // Return whether mouse wheel is forwarded. |
| 152 return !emulator()->HandleMouseWheelEvent(event); | 152 return !emulator()->HandleMouseWheelEvent(event); |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 emulator()->SetDeviceScaleFactor(1.0f); | 588 emulator()->SetDeviceScaleFactor(1.0f); |
| 589 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 589 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
| 590 | 590 |
| 591 TouchEmulator another(this, 4.0f); | 591 TouchEmulator another(this, 4.0f); |
| 592 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 592 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
| 593 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); | 593 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); |
| 594 EXPECT_EQ(2.0f, GetCursorScaleFactor()); | 594 EXPECT_EQ(2.0f, GetCursorScaleFactor()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace content | 597 } // namespace content |
| OLD | NEW |