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

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

Issue 588843002: Fix jank caused by infobars appearing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/infobar/InfoBarContainer.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java
index 6702c0ee737ab9c2a4abc54788381d208ec2789b..46778e005f0f0f3e0d37fe2c5242de273d9b1b7f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java
@@ -114,6 +114,9 @@ public class InfoBarContainer extends ScrollView {
int tabId, ViewGroup parentView, WebContents webContents) {
super(activity);
+ // Workaround for http://crbug.com/407149. See explanation in onMeasure() below.
+ setVerticalScrollBarEnabled(false);
+
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
int topMarginDp = DeviceFormFactor.isTablet(activity)
@@ -143,6 +146,19 @@ public class InfoBarContainer extends ScrollView {
mNativeInfoBarContainer = nativeInit(webContents, mAutoLoginDelegate);
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ // Only enable scrollbars when the view is actually scrollable.
+ // This prevents 10-15 frames of jank that would otherwise occur 1.2 seconds after the
+ // InfoBarContainer is attached to the window. See: http://crbug.com/407149
+ boolean canScroll = mLinearLayout.getMeasuredHeight() > getMeasuredHeight();
+ if (canScroll != isVerticalScrollBarEnabled()) {
+ setVerticalScrollBarEnabled(canScroll);
+ }
+ }
+
/**
* @return The LinearLayout that holds the infobars (i.e. the ContentWrapperViews).
*/
« 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