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

Unified Diff: ui/events/cocoa/events_mac.mm

Issue 2654653002: Handle floating point coordinates from ozone to exosphere (Closed)
Patch Set: 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 | « components/exo/wayland/server.cc ('k') | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/cocoa/events_mac.mm
diff --git a/ui/events/cocoa/events_mac.mm b/ui/events/cocoa/events_mac.mm
index 09398f922e1bcae9f64c19eb87744bc24a1a1e21..29b7fc9601d5275b81fffed7312710c1eba98f16 100644
--- a/ui/events/cocoa/events_mac.mm
+++ b/ui/events/cocoa/events_mac.mm
@@ -90,14 +90,18 @@ base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) {
}
gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
+ return gfx::ToFlooredPoint(EventLocationFromNativeF(native_event));
+}
+
+gfx::PointF EventLocationFromNativeF(const base::NativeEvent& native_event) {
NSWindow* window = [native_event window];
if (!window) {
NOTIMPLEMENTED(); // Point will be in screen coordinates.
- return gfx::Point();
+ return gfx::PointF();
}
NSPoint location = [native_event locationInWindow];
NSRect content_rect = [window contentRectForFrameRect:[window frame]];
- return gfx::Point(location.x, NSHeight(content_rect) - location.y);
+ return gfx::PointF(location.x, NSHeight(content_rect) - location.y);
}
gfx::Point EventSystemLocationFromNative(
« no previous file with comments | « components/exo/wayland/server.cc ('k') | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698