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

Unified Diff: ui/aura/test/ui_controls_factory_ozone.cc

Issue 774043002: ozone: Use host coordinates in UIControlsOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/ui_controls_factory_ozone.cc
diff --git a/ui/aura/test/ui_controls_factory_ozone.cc b/ui/aura/test/ui_controls_factory_ozone.cc
index ff92cd6c6f866a99a2ff92ac47fe0edbd930deeb..53d36a38096c5c99d8b50ee3bc70d83f2bc2428d 100644
--- a/ui/aura/test/ui_controls_factory_ozone.cc
+++ b/ui/aura/test/ui_controls_factory_ozone.cc
@@ -100,14 +100,19 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
screen_position_client->ConvertPointFromScreen(host_->window(),
&root_location);
}
- gfx::Point root_current_location =
- QueryLatestMousePositionRequestInHost(host_);
- host_->ConvertPointFromHost(&root_current_location);
+
+ gfx::Point host_location = root_location;
+ host_->ConvertPointToHost(&host_location);
+
+ gfx::Point native_screen_location = root_location;
+ host_->ConvertPointToNativeScreen(&native_screen_location);
if (button_down_mask_)
- PostMouseEvent(ui::ET_MOUSE_DRAGGED, root_location, 0, 0);
+ PostMouseEvent(ui::ET_MOUSE_DRAGGED, host_location,
+ native_screen_location, 0, 0);
else
- PostMouseEvent(ui::ET_MOUSE_MOVED, root_location, 0, 0);
+ PostMouseEvent(ui::ET_MOUSE_MOVED, host_location, native_screen_location,
+ 0, 0);
RunClosureAfterAllPendingUIEvents(closure);
return true;
@@ -120,12 +125,20 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
ui_controls::MouseButton type,
int state,
const base::Closure& closure) override {
- gfx::Point loc = aura::Env::GetInstance()->last_mouse_location();
+ gfx::Point root_location = aura::Env::GetInstance()->last_mouse_location();
aura::client::ScreenPositionClient* screen_position_client =
aura::client::GetScreenPositionClient(host_->window());
if (screen_position_client) {
- screen_position_client->ConvertPointFromScreen(host_->window(), &loc);
+ screen_position_client->ConvertPointFromScreen(host_->window(),
+ &root_location);
}
+
+ gfx::Point host_location = root_location;
+ host_->ConvertPointToHost(&host_location);
+
+ gfx::Point native_screen_location = root_location;
+ host_->ConvertPointToNativeScreen(&native_screen_location);
+
int flag = 0;
switch (type) {
@@ -145,12 +158,13 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
if (state & ui_controls::DOWN) {
button_down_mask_ |= flag;
- PostMouseEvent(ui::ET_MOUSE_PRESSED, loc, button_down_mask_ | flag, flag);
+ PostMouseEvent(ui::ET_MOUSE_PRESSED, host_location,
+ native_screen_location, button_down_mask_ | flag, flag);
}
if (state & ui_controls::UP) {
button_down_mask_ &= ~flag;
- PostMouseEvent(
- ui::ET_MOUSE_RELEASED, loc, button_down_mask_ | flag, flag);
+ PostMouseEvent(ui::ET_MOUSE_RELEASED, host_location,
+ native_screen_location, button_down_mask_ | flag, flag);
}
RunClosureAfterAllPendingUIEvents(closure);
@@ -195,25 +209,24 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
}
void PostMouseEvent(ui::EventType type,
- const gfx::PointF& location,
+ const gfx::PointF& host_location,
+ const gfx::PointF& native_screen_location,
int flags,
int changed_button_flags) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&UIControlsOzone::PostMouseEventTask,
- base::Unretained(this),
- type,
- location,
- flags,
+ base::Bind(&UIControlsOzone::PostMouseEventTask, base::Unretained(this),
+ type, host_location, native_screen_location, flags,
changed_button_flags));
}
void PostMouseEventTask(ui::EventType type,
- const gfx::PointF& location,
+ const gfx::PointF& host_location,
+ const gfx::PointF& native_screen_location,
int flags,
int changed_button_flags) {
- ui::MouseEvent mouse_event(
- type, location, location, flags, changed_button_flags);
+ ui::MouseEvent mouse_event(type, host_location, native_screen_location,
sadrul 2014/12/03 21:33:56 Confusing as it is, this is actually not right. Lo
+ flags, changed_button_flags);
// This hack is necessary to set the repeat count for clicks.
ui::MouseEvent mouse_event2(&mouse_event);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698