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

Unified Diff: components/exo/touch.cc

Issue 2648583003: Handle floating point coordinates from ozone to exosphere (Closed)
Patch Set: fixed wayland unittest 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/exo/touch_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/touch.cc
diff --git a/components/exo/touch.cc b/components/exo/touch.cc
index 7d06d80aad6aa699b200b2192d892429ada5317b..81004c69a477d79a5a000f378ef9ea4b6789f820 100644
--- a/components/exo/touch.cc
+++ b/components/exo/touch.cc
@@ -27,6 +27,17 @@ bool VectorContainsItem(T& vector, U value) {
return FindVectorItem(vector, value) != vector.end();
}
+gfx::PointF EventLocationInWindow(ui::TouchEvent* event, aura::Window* window) {
+ ui::Layer* root = window->GetRootWindow()->layer();
+ ui::Layer* target = window->layer();
+
+ gfx::Transform transform;
+ target->GetTargetTransformRelativeTo(root, &transform);
+ auto point = gfx::Point3F(event->root_location_f());
+ transform.TransformPointReverse(&point);
+ return point.AsPointF();
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -77,9 +88,7 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
// Convert location to focus surface coordinate space.
DCHECK(focus_);
- gfx::Point location = event->location();
- aura::Window::ConvertPointToTarget(target->window(), focus_->window(),
- &location);
+ gfx::PointF location = EventLocationInWindow(event, focus_->window());
// Generate a touch down event for the focus surface. Note that this can
// be different from the target surface.
@@ -115,11 +124,7 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
DCHECK(focus_);
// Convert location to focus surface coordinate space.
- gfx::Point location = event->location();
- aura::Window::ConvertPointToTarget(
- static_cast<aura::Window*>(event->target()), focus_->window(),
- &location);
-
+ gfx::PointF location = EventLocationInWindow(event, focus_->window());
delegate_->OnTouchMotion(event->time_stamp(), event->touch_id(),
location);
send_details = true;
« no previous file with comments | « no previous file | components/exo/touch_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698