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

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

Issue 1988553002: Android omnibox: Force paragraph direction to LTR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ApiCompatibilityUtils version of setTextDirection|Alignment. Created 4 years, 6 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 | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java ('k') | 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/UrlBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
index 596d18a48075b6aa0170168e46c1e502f938b914..919809bcb22e566088a99d73773d285efa200e8d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
@@ -437,6 +437,19 @@ public class UrlBar extends VerticallyFixedEditText {
}
if (focused) StartupMetrics.getInstance().recordFocusedOmnibox();
+
+ // When unfocused, force left-to-right rendering at the paragraph level (which is desired
+ // for URLs). Right-to-left runs are still rendered RTL, but will not flip the whole URL
+ // around. This is consistent with OmniboxViewViews on desktop. When focused, render text
+ // normally (to allow users to make non-URL searches and to avoid showing Android's split
+ // insertion point when an RTL user enters RTL text).
+ if (focused) {
+ ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_INHERIT);
+ } else {
+ ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_LTR);
+ }
+ // Always align to the same as the paragraph direction (LTR = left, RTL = right).
+ ApiCompatibilityUtils.setTextAlignment(this, TEXT_ALIGNMENT_TEXT_START);
}
/**
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698