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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/TabBase.java

Issue 159853008: Avoid zero resizing on prerender swap-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/TabBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java b/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java
index 357b4fa7fbb3fbd22acc6dde60718e400c15180a..c2fe01f583b5537ad7de4ccfafd58c05399861bd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java
@@ -832,11 +832,23 @@ public abstract class TabBase implements NavigationClient {
@CalledByNative
private void swapWebContents(
final long newWebContents, boolean didStartLoad, boolean didFinishLoad) {
- if (mContentViewCore != null) mContentViewCore.onHide();
+ int originalWidth = 0;
+ int originalHeight = 0;
+ if (mContentViewCore != null) {
+ originalWidth = mContentViewCore.getViewportWidthPix();
+ originalHeight = mContentViewCore.getViewportHeightPix();
+ mContentViewCore.onHide();
+ }
destroyContentView(false);
NativePage previousNativePage = mNativePage;
mNativePage = null;
initContentView(newWebContents);
+ // Size of the new ContentViewCore is zero at this point. If we don't call onSizeChanged(),
+ // next onShow() call would send a resize message with the current ContentViewCore size
+ // (zero) to the renderer process, although the new size will be set soon.
+ // However, this size fluttering may confuse Blink and rendered result can be broken
+ // (see http://crbug.com/340987).
+ mContentViewCore.onSizeChanged(originalWidth, originalHeight, 0, 0);
mContentViewCore.onShow();
mContentViewCore.attachImeAdapter();
for (TabObserver observer : mObservers) observer.onContentChanged(this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698