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..3513e1a6ef809c52d7b883bd5476004ff2ee564b 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 |
| @@ -505,27 +505,35 @@ size_t CalculatePositionsInFrame( |
| 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]; |
| // 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( |
|
groby-ooo-7-16
2014/05/02 01:31:11
You can remove "AsButtonDecoration" - all decorati
macourteau
2014/05/02 14:35:09
Done.
|
| - [self frameForDecoration:decoration inFrame:cellFrame]); |
| + [self frameForDecoration:decoration inFrame:cellFrame], |
|
groby-ooo-7-16
2014/05/02 01:31:11
Shouldn't this be decorationRect?
macourteau
2014/05/02 14:35:09
Done (and changed above for trackMouse as well, ev
|
| + 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; |