| Index: ui/views/cocoa/bridged_content_view.mm
|
| diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
|
| index df3db44b3870fbe7cf988ca045b78d0e43178369..92f3be7863d6d7719d00949044393055c635a580 100644
|
| --- a/ui/views/cocoa/bridged_content_view.mm
|
| +++ b/ui/views/cocoa/bridged_content_view.mm
|
| @@ -9,6 +9,7 @@
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "ui/base/ime/text_input_client.h"
|
| #include "ui/gfx/canvas_paint_mac.h"
|
| +#import "ui/gfx/mac/coordinate_conversion.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| #include "ui/strings/grit/ui_strings.h"
|
| #include "ui/views/view.h"
|
| @@ -59,6 +60,33 @@
|
| [self removeTrackingArea:trackingArea_.get()];
|
| }
|
|
|
| +- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
|
| + if (!hostedView_)
|
| + return;
|
| +
|
| + NSWindow* source = [theEvent window];
|
| + NSWindow* target = [self window];
|
| + DCHECK(target);
|
| +
|
| + // If there's no window, or it's the view's window, process normally.
|
| + if (!source || [target isEqual:source]) {
|
| + [self handleMouseEvent:theEvent];
|
| + return;
|
| + }
|
| +
|
| + // Otherwise, the coordinates will be based in another window's. Modifying
|
| + // NSEvents is hard, so convert by translating by the relative locations of
|
| + // *top* left of the *content* area of each window, in screen coordinates.
|
| + NSRect sourceRect = [source contentRectForFrameRect:[source frame]];
|
| + NSRect targetRect = [target contentRectForFrameRect:[target frame]];
|
| + gfx::Vector2d offset(NSMinX(sourceRect) - NSMinX(targetRect),
|
| + NSMaxY(targetRect) - NSMaxY(sourceRect));
|
| +
|
| + ui::MouseEvent event(theEvent);
|
| + event.set_location(event.location() + offset);
|
| + hostedView_->GetWidget()->OnMouseEvent(&event);
|
| +}
|
| +
|
| // BridgedContentView private implementation.
|
|
|
| - (void)handleMouseEvent:(NSEvent*)theEvent {
|
|
|