Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| index 16d56a8b9b7a725811913f92cf5e0d6683726851..629a59f42323c8be77a13abdb6eb8505eaf6abe5 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| @@ -501,31 +501,39 @@ size_t CalculatePositionsInFrame( |
| // Track the mouse until the user releases the button. |
| [self trackMouse:theEvent |
| - inRect:cellFrame |
| + inRect:decorationRect |
| ofView:controlView |
| untilMouseUp:YES]; |
| + const NSPoint mouseLocation = [[NSApp currentEvent] locationInWindow]; |
| + const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil]; |
| + |
| // Post delayed focus notification, if necessary. |
| - if (focusEvent.get()) |
| + if (focusEvent.get() && !button->PreventFocus(point)) |
| [self focusNotificationFor:focusEvent ofView:controlView]; |
|
Scott Hess - ex-Googler
2014/05/08 23:00:47
I don't recall who originally wrote this code, but
groby-ooo-7-16
2014/05/08 23:14:07
The original writer would be me :)
focusEvent is
Scott Hess - ex-Googler
2014/05/08 23:21:36
Apologies, did not notice the missing _. In that
macourteau
2014/05/09 14:00:27
Done.
|
| // Set the proper state (hover or normal) once the mouse has been released, |
| // and call |OnMousePressed| if the button was released while the mouse was |
| // within the bounds of the button. |
| - const NSPoint mouseLocation = [[NSApp currentEvent] locationInWindow]; |
| - const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil]; |
| if (NSMouseInRect(point, decorationRect, [controlView isFlipped])) { |
| button->SetButtonState(ButtonDecoration::kButtonStateHover); |
| [controlView setNeedsDisplay:YES]; |
| - handled = decoration->AsButtonDecoration()->OnMousePressed( |
| - [self frameForDecoration:decoration inFrame:cellFrame]); |
| + handled = decoration->OnMousePressed( |
| + [self frameForDecoration:decoration inFrame:cellFrame], |
| + NSMakePoint(point.x - decorationRect.origin.x, |
| + point.y - decorationRect.origin.y)); |
| } else { |
| button->SetButtonState(ButtonDecoration::kButtonStateNormal); |
| [controlView setNeedsDisplay:YES]; |
| handled = true; |
| } |
| } else { |
| - handled = decoration->OnMousePressed(decorationRect); |
| + const NSPoint mouseLocation = [theEvent locationInWindow]; |
| + const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil]; |
| + handled = decoration->OnMousePressed( |
| + decorationRect, |
| + NSMakePoint(point.x - decorationRect.origin.x, |
| + point.y - decorationRect.origin.y)); |
| } |
| return handled ? YES : NO; |