| Index: content/renderer/render_view_impl.cc
|
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
| index d8f36c759358b1d1e112e4419c0cbd9c3a5f3955..05e29b057b83a0d5c008b9b43db5ff0ae107b5c0 100644
|
| --- a/content/renderer/render_view_impl.cc
|
| +++ b/content/renderer/render_view_impl.cc
|
| @@ -1811,27 +1811,41 @@ bool RenderViewImpl::runFileChooser(
|
| return ScheduleFileChooser(ipc_params, chooser_completion);
|
| }
|
|
|
| -void RenderViewImpl::showValidationMessage(
|
| - const blink::WebRect& anchor_in_root_view,
|
| - const blink::WebString& main_text,
|
| - const blink::WebString& sub_text,
|
| - blink::WebTextDirection hint) {
|
| - base::string16 wrapped_main_text = main_text;
|
| - base::string16 wrapped_sub_text = sub_text;
|
| - if (hint == blink::WebTextDirectionLeftToRight) {
|
| +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);
|
| - if (!wrapped_sub_text.empty()) {
|
| + } 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 (hint == blink::WebTextDirectionRightToLeft
|
| - && !base::i18n::IsRTL()) {
|
| - base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text);
|
| - if (!wrapped_sub_text.empty()) {
|
| + } 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 sub_text_hint) {
|
| + base::string16 wrapped_main_text = main_text;
|
| + base::string16 wrapped_sub_text = 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));
|
|
|