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

Unified Diff: ui/views/test/event_generator_delegate_mac.mm

Issue 1875003002: Using ui::test::EventGenerator Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Track window offset correctly - expect regressions on mac Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/style/platform_style_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/event_generator_delegate_mac.mm
diff --git a/ui/views/test/event_generator_delegate_mac.mm b/ui/views/test/event_generator_delegate_mac.mm
index 44e08a5adaea5aabfe0ef6f305d7098f3ea99b28..06d7b144b892227d29f29289cbd7b26f451dd812 100644
--- a/ui/views/test/event_generator_delegate_mac.mm
+++ b/ui/views/test/event_generator_delegate_mac.mm
@@ -36,13 +36,9 @@ namespace {
NSPoint ConvertRootPointToTarget(NSWindow* target,
const gfx::Point& point_in_root) {
- // Normally this would do ui::ConvertPointFromScreenToWindow. However, Cocoa
- // can reposition the window on screen and make things flaky. Initially, just
- // assume that the contentRect of |target| is at the top-left corner of the
- // screen.
- NSRect content_rect = [target contentRectForFrameRect:[target frame]];
- return NSMakePoint(point_in_root.x(),
- NSHeight(content_rect) - point_in_root.y());
+ // For Mac, assume the root window equates to the primary screen.
+ return ui::ConvertPointFromScreenToWindow(
+ target, gfx::ScreenPointToNSPoint(point_in_root));
}
// Inverse of ui::EventFlagsFromModifiers().
@@ -349,10 +345,8 @@ EventGeneratorDelegateMac::GetChildIterator() const {
}
void EventGeneratorDelegateMac::OnMouseEvent(ui::MouseEvent* event) {
- NSEvent* ns_event = CreateMouseEventInWindow(window_,
- event->type(),
- event->location(),
- event->changed_button_flags());
+ NSEvent* ns_event = CreateMouseEventInWindow(
+ window_, event->type(), event->location(), event->flags());
if (owner_->targeting_application())
[NSApp sendEvent:ns_event];
else
« no previous file with comments | « ui/views/style/platform_style_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698