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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 2126023003: Mac (Cocoa) Omnibox: Force text field to LTR context if it is a URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to feedback. Created 4 years, 5 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/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index 06eb963f144210240db6fe9dcd0501a312335f49..75a778970012546e8a38d2a1c469b5dfed94a768 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -562,6 +562,11 @@ void OmniboxViewMac::ApplyTextStyle(
[paragraph_style setMaximumLineHeight:line_height];
[paragraph_style setMinimumLineHeight:line_height];
[paragraph_style setLineBreakMode:NSLineBreakByTruncatingTail];
+ // If this is a URL, set the top-level paragraph direction to LTR (avoids RTL
+ // characters from making the URL render from right to left, as per RFC 3987
+ // Section 4.1).
+ if (model()->CurrentTextIsURL())
+ [paragraph_style setBaseWritingDirection:NSWritingDirectionLeftToRight];
[attributedString addAttribute:NSParagraphStyleAttributeName
value:paragraph_style
range:NSMakeRange(0, [attributedString length])];
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698