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

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

Issue 2862983003: Ensure Omnibox suggestion measure width matches layout width.
Patch Set: Created 3 years, 7 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/SuggestionView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
index bbf2c77cb5e52f508ccdf5357587f577ac88e64d..9df9a4591870428b9fa5a80804fd602ba473473a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
@@ -821,8 +821,6 @@ class SuggestionView extends ViewGroup {
}
// Align the text to be pixel perfectly aligned with the text in the url bar.
- mTextLeft = getSuggestionTextLeftPosition();
- mTextRight = getSuggestionTextRightPosition();
boolean isRTL = ApiCompatibilityUtils.isLayoutRtl(this);
if (DeviceFormFactor.isTablet(getContext())) {
int textWidth = isRTL ? mTextRight : (r - l - mTextLeft);
@@ -918,17 +916,20 @@ class SuggestionView extends ViewGroup {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
+ boolean isRTL = ApiCompatibilityUtils.isLayoutRtl(this);
+ mTextLeft = getSuggestionTextLeftPosition();
+ mTextRight = getSuggestionTextRightPosition();
+
+ int maxWidth = width - (isRTL ? mTextRight : mTextLeft);
if (mTextLine1.getMeasuredWidth() != width
|| mTextLine1.getMeasuredHeight() != height) {
- mTextLine1.measure(
- MeasureSpec.makeMeasureSpec(widthMeasureSpec, MeasureSpec.AT_MOST),
+ mTextLine1.measure(MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(mSuggestionHeight, MeasureSpec.AT_MOST));
}
if (mTextLine2.getMeasuredWidth() != width
|| mTextLine2.getMeasuredHeight() != height) {
- mTextLine2.measure(
- MeasureSpec.makeMeasureSpec(widthMeasureSpec, MeasureSpec.AT_MOST),
+ mTextLine2.measure(MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(mSuggestionHeight, MeasureSpec.AT_MOST));
}
if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
« 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