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

Side by Side Diff: content/browser/renderer_host/input/touch_emulator_unittest.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Truncated to int on input, git cl format Created 3 years, 8 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 "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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 shift_pressed_ = false; 131 shift_pressed_ = false;
132 SendKeyboardEvent(WebInputEvent::KeyUp); 132 SendKeyboardEvent(WebInputEvent::KeyUp);
133 } 133 }
134 134
135 void SendMouseEvent(WebInputEvent::Type type, int x, int y) { 135 void SendMouseEvent(WebInputEvent::Type type, int x, int y) {
136 WebMouseEvent event(type, modifiers(), GetNextEventTimeSeconds()); 136 WebMouseEvent event(type, modifiers(), GetNextEventTimeSeconds());
137 event.button = mouse_pressed_ ? WebMouseEvent::Button::Left : 137 event.button = mouse_pressed_ ? WebMouseEvent::Button::Left :
138 WebMouseEvent::Button::NoButton; 138 WebMouseEvent::Button::NoButton;
139 last_mouse_x_ = x; 139 last_mouse_x_ = x;
140 last_mouse_y_ = y; 140 last_mouse_y_ = y;
141 event.x = event.globalX = x; 141 event.setPositionInWidget(x, y);
142 event.y = event.globalY = y; 142 event.setPositionInScreen(x, y);
143 emulator()->HandleMouseEvent(event); 143 emulator()->HandleMouseEvent(event);
144 } 144 }
145 145
146 bool SendMouseWheelEvent() { 146 bool SendMouseWheelEvent() {
147 WebMouseWheelEvent event(WebInputEvent::MouseWheel, modifiers(), 147 WebMouseWheelEvent event(WebInputEvent::MouseWheel, modifiers(),
148 GetNextEventTimeSeconds()); 148 GetNextEventTimeSeconds());
149 // Return whether mouse wheel is forwarded. 149 // Return whether mouse wheel is forwarded.
150 return !emulator()->HandleMouseWheelEvent(event); 150 return !emulator()->HandleMouseWheelEvent(event);
151 } 151 }
152 152
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 emulator()->SetDeviceScaleFactor(1.0f); 586 emulator()->SetDeviceScaleFactor(1.0f);
587 EXPECT_EQ(1.0f, GetCursorScaleFactor()); 587 EXPECT_EQ(1.0f, GetCursorScaleFactor());
588 588
589 TouchEmulator another(this, 4.0f); 589 TouchEmulator another(this, 4.0f);
590 EXPECT_EQ(1.0f, GetCursorScaleFactor()); 590 EXPECT_EQ(1.0f, GetCursorScaleFactor());
591 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); 591 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
592 EXPECT_EQ(2.0f, GetCursorScaleFactor()); 592 EXPECT_EQ(2.0f, GetCursorScaleFactor());
593 } 593 }
594 594
595 } // namespace content 595 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698