Commit 49f07ee5 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Update all WebContents on resize event

Upon screen resize, only the WebContents on the front got the timely
update while those in the back were updated later when they got to
the front. This has a caveat when working with Android tabswitcher
where the one in the background can be shown without it going fore-
ground as reported in the bug. This CL fixes it by enumerating all
the WebContents and update their size when the resize event occurs.

This had been previously handled by each |ContentView.onSizeChanged|
per WebContents, but r522517 changed the way Chrome handles the resize
event. So this should also be taken care of by CompositorViewHolder
for each WebContents as well.

Bug: 798277
Change-Id: I4b0d25850ded812668e5bdbba52c4898492bd9cd
Reviewed-on: https://chromium-review.googlesource.com/848758Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527121}
parent 294a9c10
...@@ -47,6 +47,7 @@ import org.chromium.chrome.browser.tab.Tab; ...@@ -47,6 +47,7 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabObserver;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabCreatorManager;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.ColorUtils;
...@@ -455,7 +456,15 @@ public class CompositorViewHolder extends FrameLayout ...@@ -455,7 +456,15 @@ public class CompositorViewHolder extends FrameLayout
@Override @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) { protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh);
setSize(getActiveWebContents(), getActiveView(), w, h); if (mTabModelSelector == null) return;
for (TabModel tabModel : mTabModelSelector.getModels()) {
for (int i = 0; i < tabModel.getCount(); ++i) {
Tab tab = tabModel.getTabAt(i);
if (tab == null) continue;
setSize(tab.getWebContents(), tab.getContentView(), w, h);
}
}
} }
/** /**
......
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