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..a9ec4a80d62551cd967de60dcd2d8bb9c9dde52b 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 |
@@ -492,6 +492,13 @@ size_t CalculatePositionsInFrame( |
DCHECK_EQ([event type], NSLeftMouseUp); |
} |
+ // Figure out where the click happened inside the decoration. |
+ const NSPoint mouseLocation = |
+ [controlView convertPoint:[[NSApp currentEvent] locationInWindow] |
groby-ooo-7-16
2014/04/10 21:26:09
Why not use the current event that you already hav
macourteau
2014/04/28 19:19:24
Done and Done. :)
|
+ fromView:nil]; |
+ const NSPoint clickLocation = { mouseLocation.x - decorationRect.origin.x, |
+ mouseLocation.y - decorationRect.origin.y }; |
+ |
bool handled; |
if (decoration->AsButtonDecoration()) { |
ButtonDecoration* button = decoration->AsButtonDecoration(); |
@@ -505,10 +512,6 @@ size_t CalculatePositionsInFrame( |
ofView:controlView |
untilMouseUp:YES]; |
- // Post delayed focus notification, if necessary. |
- if (focusEvent.get()) |
- [self focusNotificationFor:focusEvent ofView:controlView]; |
groby-ooo-7-16
2014/04/10 21:26:09
The focus notification should always happen before
macourteau
2014/04/28 19:19:24
Hmm, the problem I'm having is that when the chip
groby-ooo-7-16
2014/04/30 21:55:39
All suggestions are going to amount to evil hacker
macourteau
2014/05/01 19:04:48
The "PreventFocus" trick seems to work. The only p
|
- |
// 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. |
@@ -518,14 +521,20 @@ size_t CalculatePositionsInFrame( |
button->SetButtonState(ButtonDecoration::kButtonStateHover); |
[controlView setNeedsDisplay:YES]; |
handled = decoration->AsButtonDecoration()->OnMousePressed( |
- [self frameForDecoration:decoration inFrame:cellFrame]); |
+ [self frameForDecoration:decoration inFrame:cellFrame], |
+ clickLocation); |
} else { |
button->SetButtonState(ButtonDecoration::kButtonStateNormal); |
[controlView setNeedsDisplay:YES]; |
handled = true; |
} |
+ |
+ // Post delayed focus notification, if necessary, after calling the button's |
+ // |OnMousePressed|. |
+ if (focusEvent.get()) |
+ [self focusNotificationFor:focusEvent ofView:controlView]; |
} else { |
- handled = decoration->OnMousePressed(decorationRect); |
+ handled = decoration->OnMousePressed(decorationRect, clickLocation); |
} |
return handled ? YES : NO; |