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

Unified Diff: content/renderer/render_view_impl.cc

Issue 391923006: Extra parameter to pass sub-message direction for validation message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to latest master Created 6 years, 3 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 | « content/renderer/render_view_impl.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index a7df08bed46f4974db0d7019cfaf1a1bc0385371..6f874fd7c36579005beeee83e5615b87b8f93f2f 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1809,27 +1809,41 @@ bool RenderViewImpl::runFileChooser(
return ScheduleFileChooser(ipc_params, chooser_completion);
}
+void RenderViewImpl::SetValidationMessageDirection(
+ base::string16* wrapped_main_text,
+ blink::WebTextDirection main_text_hint,
+ base::string16* wrapped_sub_text,
+ blink::WebTextDirection sub_text_hint) {
+ if (main_text_hint == blink::WebTextDirectionLeftToRight) {
+ *wrapped_main_text =
+ base::i18n::GetDisplayStringInLTRDirectionality(*wrapped_main_text);
+ } else if (main_text_hint == blink::WebTextDirectionRightToLeft &&
+ !base::i18n::IsRTL()) {
+ base::i18n::WrapStringWithRTLFormatting(wrapped_main_text);
+ }
+
+ if (!wrapped_sub_text->empty()) {
+ if (sub_text_hint == blink::WebTextDirectionLeftToRight) {
+ *wrapped_sub_text =
+ base::i18n::GetDisplayStringInLTRDirectionality(*wrapped_sub_text);
+ } else if (sub_text_hint == blink::WebTextDirectionRightToLeft) {
+ base::i18n::WrapStringWithRTLFormatting(wrapped_sub_text);
+ }
+ }
+}
+
void RenderViewImpl::showValidationMessage(
const blink::WebRect& anchor_in_root_view,
const blink::WebString& main_text,
+ blink::WebTextDirection main_text_hint,
const blink::WebString& sub_text,
- blink::WebTextDirection hint) {
+ blink::WebTextDirection sub_text_hint) {
base::string16 wrapped_main_text = main_text;
base::string16 wrapped_sub_text = sub_text;
- if (hint == blink::WebTextDirectionLeftToRight) {
- wrapped_main_text =
- base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text);
- if (!wrapped_sub_text.empty()) {
- wrapped_sub_text =
- base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text);
- }
- } else if (hint == blink::WebTextDirectionRightToLeft
- && !base::i18n::IsRTL()) {
- base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text);
- if (!wrapped_sub_text.empty()) {
- base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text);
- }
- }
+
+ SetValidationMessageDirection(
+ &wrapped_main_text, main_text_hint, &wrapped_sub_text, sub_text_hint);
+
Send(new ViewHostMsg_ShowValidationMessage(
routing_id(), AdjustValidationMessageAnchor(anchor_in_root_view),
wrapped_main_text, wrapped_sub_text));
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698