Commit b2fa79b8 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Revert "Remove makeKeyAndOrderFront: from WebContentsViewMac::Focus()."

This reverts commit 292ad04d.

Reason for revert: I think this caused an active window test failure, see https://crbug.com/861963

Original change's description:
> Remove makeKeyAndOrderFront: from WebContentsViewMac::Focus().
> 
> WebContentsView::Focus() is supposed to update the first responder of the
> Window, not make the window focused. The latter should go through
> WebContentsDelegate::ActivateContents().
> 
> This logic is usually a no-op because the window receiving the call is the
> active window. But in the case where the user quickly switches windows, this can
> cause the old window to re-take focus.
> 
> This logic was added in 2009 not because it had the right semantics, but to
> match the behavior of Windows: http://codereview.chromium.org/165492.
> 
> Bug: 859614
> Change-Id: I2bc44a825d93159d774c632da17cc2f2d151fc3a
> Reviewed-on: https://chromium-review.googlesource.com/1124772
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Commit-Queue: Erik Chen <erikchen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#573344}

TBR=avi@chromium.org,erikchen@chromium.org

Change-Id: I6ae990055c9a9cf0bd84f7599939e25490178304
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 859614
Reviewed-on: https://chromium-review.googlesource.com/1130141Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573517}
parent 8e3141ae
...@@ -198,6 +198,9 @@ void WebContentsViewMac::Focus() { ...@@ -198,6 +198,9 @@ void WebContentsViewMac::Focus() {
gfx::NativeView native_view = GetNativeViewForFocus(); gfx::NativeView native_view = GetNativeViewForFocus();
NSWindow* window = [native_view window]; NSWindow* window = [native_view window];
[window makeFirstResponder:native_view]; [window makeFirstResponder:native_view];
if (![window isVisible])
return;
[window makeKeyAndOrderFront:nil];
} }
void WebContentsViewMac::SetInitialFocus() { void WebContentsViewMac::SetInitialFocus() {
......
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