Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 2679273002: [Mac] Retain location bar focus on switching to fullscreen and back. (Closed)
Patch Set: Fix regression with the toolbar not dropping down. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f03a5d49b87df27f760acb7fef15204f02b214fb 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -962,7 +962,15 @@ willPositionSheet:(NSWindow*)sheet
if ([findBarCocoaController_ view])
[subviews addObject:[findBarCocoaController_ view]];
+ // -setContentViewSubviews: changes the view hierarchy, and if the
spqchan 2017/02/08 19:21:50 "is focused will" -> "is focused, it will
shrike 2017/02/08 19:51:42 I massaged it a bit more to avoid "it will cause i
+ // 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/08 19:21:50 nit: No curly brackets required. Also maybe you ca
shrike 2017/02/08 19:51:42 I removed the curly braces. Coding if statements w
spqchan 2017/02/09 01:50:34 Hey, to be fair, the reason I use this style in th
shrike 2017/02/09 02:18:29 I hear you that your reviewers told you that curly
spqchan 2017/02/09 05:09:36 Makes sense. Since the codebase will be changed so
+ [self focusLocationBar:YES];
+ }
}
- (void)updateSubviewZOrderFullscreen {
@@ -1002,7 +1010,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) {
+ [self focusLocationBar:YES];
+ }
}
- (void)setContentViewSubviews:(NSArray*)subviews {

Powered by Google App Engine
This is Rietveld 408576698