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

Unified Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.cc

Issue 2945173006: VR: Enforce LTR directionality on rendered URL text. (Closed)
Patch Set: Add a test to ensure that a malicious RTL URL cannot spoof a hostname. Created 3 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
Index: chrome/browser/android/vr_shell/textures/url_bar_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
index 65a84f96f246c9da0996df7028180c35cb1bc63b..1e1a85c417514df0ab8975e40725b998a11f94ea 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/android/vr_shell/textures/url_bar_texture.h"
-#include "base/i18n/rtl.h"
#include "base/strings/utf_string_conversions.h"
#include "cc/paint/skia_paint_canvas.h"
#include "chrome/browser/android/vr_shell/color_scheme.h"
@@ -353,9 +352,6 @@ void UrlBarTexture::RenderUrl(const gfx::Size& texture_size,
gurl_, url_formatter::kFormatUrlOmitAll, net::UnescapeRule::NORMAL,
&parsed, nullptr, nullptr);
- if (base::i18n::StringContainsStrongRTLChars(text))
- failure_callback_.Run(UiUnsupportedMode::kURLWithStrongRTLChars);
-
int pixel_font_height = texture_size.height() * kFontHeight / kHeight;
gfx::FontList font_list;
@@ -368,6 +364,7 @@ void UrlBarTexture::RenderUrl(const gfx::Size& texture_size,
render_text->SetColor(SK_ColorBLACK);
render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
render_text->SetElideBehavior(gfx::ELIDE_TAIL);
+ render_text->SetDirectionalityMode(gfx::DIRECTIONALITY_FORCE_LTR);
render_text->SetText(text);
render_text->SetDisplayRect(bounds);
@@ -391,6 +388,7 @@ void UrlBarTexture::RenderUrl(const gfx::Size& texture_size,
color_scheme());
url_render_text_ = std::move(render_text);
+ url_text_ = text;
}
// This method replicates behavior in OmniboxView::UpdateTextStyle(), and

Powered by Google App Engine
This is Rietveld 408576698