| 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 9dc8a9860b4073bb498982825d4de174ba3cdef4..efd23fef541e9fe1c851c5f3ed2ca3042e61c6cb 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
|
| @@ -12,6 +12,7 @@ import android.graphics.Canvas;
|
| import android.graphics.Paint;
|
| import android.graphics.Rect;
|
| import android.net.Uri;
|
| +import android.os.Build;
|
| import android.os.StrictMode;
|
| import android.os.SystemClock;
|
| import android.text.Editable;
|
| @@ -65,6 +66,9 @@ public class UrlBar extends VerticallyFixedEditText {
|
| private static final int MAX_DISPLAYABLE_LENGTH = 4000;
|
| private static final int MAX_DISPLAYABLE_LENGTH_LOW_END = 1000;
|
|
|
| + // Unicode "Left-To-Right Mark" (LRM) character.
|
| + private static final char LRM = '\u200E';
|
| +
|
| /** The contents of the URL that precede the path/query after being formatted. */
|
| private String mFormattedUrlLocation;
|
|
|
| @@ -758,6 +762,13 @@ public class UrlBar extends VerticallyFixedEditText {
|
| */
|
| public boolean setUrl(String url, String formattedUrl) {
|
| if (!TextUtils.isEmpty(formattedUrl)) {
|
| + // Because Android versions 4.2 and before lack proper RTL support,
|
| + // force the formatted URL to render as LTR using an LRM character.
|
| + // See: https://www.ietf.org/rfc/rfc3987.txt and crbug.com/709417
|
| + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
| + formattedUrl = LRM + formattedUrl;
|
| + }
|
| +
|
| try {
|
| URL javaUrl = new URL(url);
|
| mFormattedUrlLocation =
|
|
|