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 d9e3df05bb46b6083eeed03734f2870ebf7dbae1..8ddbcc2c80f4f9d049c54df395dec1d914f97179 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 |
@@ -327,9 +327,7 @@ class SuggestionView extends ViewGroup { |
setSuggestedQuery(suggestionItem, false, false, false); |
if ((suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_ENTITY) |
|| (suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_PROFILE)) { |
- showDescriptionLine( |
- SpannableString.valueOf(mSuggestion.getDescription()), |
- getStandardFontColor()); |
+ showDescriptionLine(SpannableString.valueOf(mSuggestion.getDescription()), false); |
} else { |
mContentsView.mTextLine2.setVisibility(INVISIBLE); |
} |
@@ -393,7 +391,7 @@ class SuggestionView extends ViewGroup { |
Spannable str = SpannableString.valueOf(suggestion.getDisplayText()); |
boolean hasMatch = applyHighlightToMatchRegions( |
str, suggestion.getDisplayTextClassifications()); |
- showDescriptionLine(str, URL_COLOR); |
+ showDescriptionLine(str, true); |
return hasMatch; |
} |
@@ -427,13 +425,25 @@ class SuggestionView extends ViewGroup { |
* Sets a description line for the omnibox suggestion. |
* |
* @param str The description text. |
+ * @param isUrl Whether this text is a URL (as opposed to a normal string). |
*/ |
- private void showDescriptionLine(Spannable str, int textColor) { |
- if (mContentsView.mTextLine2.getVisibility() != VISIBLE) { |
- mContentsView.mTextLine2.setVisibility(VISIBLE); |
+ private void showDescriptionLine(Spannable str, boolean isUrl) { |
+ TextView textLine = mContentsView.mTextLine2; |
+ if (textLine.getVisibility() != VISIBLE) { |
+ textLine.setVisibility(VISIBLE); |
+ } |
+ textLine.setText(str, BufferType.SPANNABLE); |
+ |
+ // Force left-to-right rendering for URLs. See UrlBar constructor for details. |
+ if (isUrl) { |
+ textLine.setTextColor(URL_COLOR); |
+ textLine.setTextDirection(TEXT_DIRECTION_LTR); |
+ textLine.setTextAlignment(TEXT_ALIGNMENT_VIEW_START); |
+ } else { |
+ textLine.setTextColor(getStandardFontColor()); |
+ textLine.setTextDirection(TEXT_DIRECTION_INHERIT); |
+ textLine.setTextAlignment(TEXT_ALIGNMENT_INHERIT); |
} |
- mContentsView.mTextLine2.setTextColor(textColor); |
- mContentsView.mTextLine2.setText(str, BufferType.SPANNABLE); |
} |
/** |