Commit ad169c04 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac: restore focus to location bar after fullscreen transition

When creating a new window in fullscreen, we currently:
- Create the window, focusing the location bar as expected
- Make the window fullscreen

As part of the fullscreen transition, we specifically clear focus from
the location bar. This means that newly created windows in fullscreen don't
automatically focus the location bar.

While the main purpose of removing focus is for fullscreen modes that
don't show the location bar, it prevents some jank even when the location bar
is shown. For that reason, disabling it when the location bar is shown is not
the best option.

Instead, let's focus the location bar when showing a fullscreen browser window
with nothing focused already. This is technically a superset of the "new window"
case but it seems preferable to a key window with nothing focused.


Bug: 884436
Change-Id: I1c1b60e293e976a2ef87bf416c36cabeabf0bca2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144415Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757958}
parent 5aa6f489
......@@ -791,6 +791,15 @@ void BrowserView::Show() {
browser()->OnWindowDidShow();
MaybeShowInvertBubbleView(this);
// The fullscreen transition clears out focus, but there are some cases (for
// example, new window in Mac fullscreen with toolbar showing) where we need
// restore it.
if (frame_->IsFullscreen() &&
!frame_->GetFrameView()->ShouldHideTopUIForFullscreen() &&
GetFocusManager() && !GetFocusManager()->GetFocusedView()) {
SetFocusToLocationBar(false);
}
}
void BrowserView::ShowInactive() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment