Commit 879cf27d authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

[WebLayer] Make sure new tab is focused when created

This is similar logic to what AwContents.java uses when creating a
popup.

Bug: 1030186
Change-Id: I0f207dae5ec53c0df68adb504544ec769534ce01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947639Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721261}
parent 874604a0
...@@ -111,7 +111,16 @@ public class ContentView extends FrameLayout ...@@ -111,7 +111,16 @@ public class ContentView extends FrameLayout
} }
public void setWebContents(WebContents webContents) { public void setWebContents(WebContents webContents) {
boolean wasFocused = isFocused();
boolean wasWindowFocused = hasWindowFocus();
boolean wasAttached = isAttachedToWindow();
if (wasFocused) onFocusChanged(false, View.FOCUS_FORWARD, null);
if (wasWindowFocused) onWindowFocusChanged(false);
if (wasAttached) onDetachedFromWindow();
mWebContents = webContents; mWebContents = webContents;
if (wasFocused) onFocusChanged(true, View.FOCUS_FORWARD, null);
if (wasWindowFocused) onWindowFocusChanged(true);
if (wasAttached) onAttachedToWindow();
} }
@Override @Override
......
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