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

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

Issue 1842543002: Optimize the URL path fading to avoid unnecessary draws when empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/omnibox/UrlContainer.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlContainer.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlContainer.java
index 972c5c5ab4cea7c924031dd314eda42fc79a8e3a..eac34eda7530b34b03d6ed420e26de33a711cc06 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlContainer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlContainer.java
@@ -199,6 +199,18 @@ public class UrlContainer extends ViewGroup {
}
/**
+ * Return whether the trailing text animations should be run.
+ *
+ * If there is no actual trailing text or the width of the leading URL bar view did not allow
+ * for any space to be allocated to the trailing text view (i.e. width == 0), then jump to the
+ * end of the animation to avoid the unnecessary draw churn.
+ */
+ private boolean shouldRunTrailingTextAnimations() {
+ return mTrailingTextView.getMeasuredWidth() > 0
+ && !TextUtils.isEmpty(mTrailingTextView.getText());
+ }
+
+ /**
* Updates the visibility of the trailing text view.
* @param visible Whether the trailing text view should be visible.
*/
@@ -253,6 +265,7 @@ public class UrlContainer extends ViewGroup {
}
});
set.start();
+ if (!shouldRunTrailingTextAnimations()) set.end();
mTrailingTextAnimator = set;
postDelayed(mTriggerHideRunnable, MAX_TRAILING_TEXT_SHOW_DURATION_MS);
@@ -292,6 +305,7 @@ public class UrlContainer extends ViewGroup {
}
});
set.start();
+ if (!shouldRunTrailingTextAnimations()) set.end();
mTrailingTextAnimator = set;
}
« 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