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

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

Issue 316053008: MacViews: Allow ui::EventLocationFromNative to handle native titlebars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: selfnit Created 6 years, 6 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 | 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 a8d93650b3610e402a5b7915be43d3bdec0035a8..13098ddb0b9bdb9662eeda3094a2bbdd2d49ab60 100644
--- a/ui/events/cocoa/events_mac.mm
+++ b/ui/events/cocoa/events_mac.mm
@@ -87,13 +87,14 @@ base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
}
gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
- if (![native_event window]) {
+ NSWindow* window = [native_event window];
+ if (!window) {
NOTIMPLEMENTED(); // Point will be in screen coordinates.
return gfx::Point();
}
NSPoint location = [native_event locationInWindow];
- return gfx::Point(location.x,
- NSHeight([[native_event window] frame]) - location.y);
+ NSRect content_rect = [window contentRectForFrameRect:[window frame]];
+ return gfx::Point(location.x, NSHeight(content_rect) - location.y);
}
tapted 2014/06/05 07:33:35 Note most of my local branches have been using a "
Robert Sesek 2014/06/05 14:08:27 I think I like extracting this information directl
gfx::Point EventSystemLocationFromNative(
« no previous file with comments | « no previous file | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698