| 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 7c49cd0444346d7291793796970f16a6d7a7c505..dc705eacdd64a9b07895152949065485f46bdcb0 100644
|
| --- a/ui/views/cocoa/bridged_content_view.mm
|
| +++ b/ui/views/cocoa/bridged_content_view.mm
|
| @@ -55,25 +55,6 @@ bool IsRectInsidePath(NSRect rect, NSBezierPath* path) {
|
| rect.origin.y + rect.size.height)];
|
| }
|
|
|
| -// Convert a |point| in |source_window|'s AppKit coordinate system (origin at
|
| -// the bottom left of the window) to |target_window|'s content rect, with the
|
| -// origin at the top left of the content area.
|
| -// If |source_window| is nil, |point| will be treated as screen coordinates.
|
| -gfx::Point MovePointToWindow(const NSPoint& point,
|
| - NSWindow* source_window,
|
| - NSWindow* target_window) {
|
| - NSPoint point_in_screen = source_window
|
| - ? ui::ConvertPointFromWindowToScreen(source_window, point)
|
| - : point;
|
| -
|
| - NSPoint point_in_window =
|
| - ui::ConvertPointFromScreenToWindow(target_window, point_in_screen);
|
| - NSRect content_rect =
|
| - [target_window contentRectForFrameRect:[target_window frame]];
|
| - return gfx::Point(point_in_window.x,
|
| - NSHeight(content_rect) - point_in_window.y);
|
| -}
|
| -
|
| // Dispatch |event| to |menu_controller| and return true if |event| is
|
| // swallowed.
|
| bool DispatchEventToMenu(MenuController* menu_controller, ui::KeyEvent* event) {
|
| @@ -345,26 +326,6 @@ - (void)clearView {
|
| [self removeTrackingArea:cursorTrackingArea_.get()];
|
| }
|
|
|
| -- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
|
| - if (!hostedView_)
|
| - return;
|
| -
|
| - NSWindow* source = [theEvent window];
|
| - NSWindow* target = [self window];
|
| - DCHECK(target);
|
| -
|
| - // If it's the view's window, process normally.
|
| - if ([target isEqual:source]) {
|
| - [self mouseEvent:theEvent];
|
| - return;
|
| - }
|
| -
|
| - ui::MouseEvent event(theEvent);
|
| - event.set_location(
|
| - MovePointToWindow([theEvent locationInWindow], source, target));
|
| - hostedView_->GetWidget()->OnMouseEvent(&event);
|
| -}
|
| -
|
| - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent {
|
| DCHECK(hostedView_);
|
| base::string16 newTooltipText;
|
| @@ -383,6 +344,13 @@ - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent {
|
| }
|
| }
|
|
|
| +- (void)hideTooltipIfRequired {
|
| + if (!lastTooltipText_.empty()) {
|
| + lastTooltipText_.clear();
|
| + [self setToolTipAtMousePoint:nil];
|
| + }
|
| +}
|
| +
|
| - (void)updateWindowMask {
|
| DCHECK(![self inLiveResize]);
|
| DCHECK(base::mac::IsOS10_9());
|
| @@ -580,19 +548,18 @@ - (void)selectAll:(id)sender {
|
| - (void)enableTracking {
|
| }
|
|
|
| +// Explicitly ignore BaseView's |dragging_| logic
|
| +- (void)mouseDown:(NSEvent*)theEvent {
|
| + [self mouseEvent:theEvent];
|
| +}
|
| +
|
| // Translates the location of |theEvent| to toolkit-views coordinates and passes
|
| // the event to NativeWidgetMac for handling.
|
| - (void)mouseEvent:(NSEvent*)theEvent {
|
| if (!hostedView_)
|
| return;
|
| -
|
| - ui::MouseEvent event(theEvent);
|
| -
|
| - // Aura updates tooltips with the help of aura::Window::AddPreTargetHandler().
|
| - // Mac hooks in here.
|
| - [self updateTooltipIfRequiredAt:event.location()];
|
| -
|
| - hostedView_->GetWidget()->OnMouseEvent(&event);
|
| + views::NativeWidgetMac::GetBridgeForNativeWindow([self window])
|
| + ->OnMouseEvent(theEvent);
|
| }
|
|
|
| // NSView implementation.
|
| @@ -776,8 +743,9 @@ - (void)scrollWheel:(NSEvent*)theEvent {
|
| if (!hostedView_)
|
| return;
|
|
|
| - ui::ScrollEvent event(theEvent);
|
| - hostedView_->GetWidget()->OnScrollEvent(&event);
|
| + // Passes the event to BridgedNativeWidget for handling.
|
| + views::NativeWidgetMac::GetBridgeForNativeWindow([self window])
|
| + ->OnMouseEvent(theEvent);
|
| }
|
|
|
| - (void)quickLookWithEvent:(NSEvent*)theEvent {
|
|
|