Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| index f084fb039ddfc634afb1cc0415d6dd245e856c66..5cb48760ddcfe063f7cf2857b6f82784e82695d8 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| @@ -962,7 +962,14 @@ willPositionSheet:(NSWindow*)sheet |
| if ([findBarCocoaController_ view]) |
| [subviews addObject:[findBarCocoaController_ view]]; |
| + // -setContentViewSubviews: changes the view hierarchy. As a result, if the |
| + // location bar is focused it will end up resigning first responder. |
| + // Remember the location bar's focus state and restore it after changing the |
| + // view hierarchy. |
| + BOOL locationBarHadFocus = [self locationBarHasFocus]; |
| [self setContentViewSubviews:subviews]; |
| + if (locationBarHadFocus) |
|
spqchan
2017/02/09 01:50:34
optional nit: if ([self locationBarHasFocus]) and
shrike
2017/02/09 02:18:29
The problem is that [self setContentViewSubviews:s
spqchan
2017/02/09 05:09:36
Ah, gotcha
|
| + [self focusLocationBar:YES]; |
| } |
| - (void)updateSubviewZOrderFullscreen { |
| @@ -1002,7 +1009,15 @@ willPositionSheet:(NSWindow*)sheet |
| if ([findBarCocoaController_ view]) |
| [subviews addObject:[findBarCocoaController_ view]]; |
| + // -setContentViewSubviews: changes the view hierarchy, and if the |
| + // location bar is focused will cause it to resign first responder. |
| + // Remember the location bar's focus state and restore it after changing the |
| + // view hierarchy. |
| + BOOL locationBarHadFocus = [self locationBarHasFocus]; |
| [self setContentViewSubviews:subviews]; |
| + if (locationBarHadFocus) { |
|
spqchan
2017/02/09 01:50:34
Ditto from above
|
| + [self focusLocationBar:YES]; |
| + } |
| } |
| - (void)setContentViewSubviews:(NSArray*)subviews { |