Chromium Code Reviews| Index: Source/core/html/HTMLFormControlElement.cpp |
| diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
| index a4e37a36cc362f9912230017706c1f74ee3793f4..cf2d0522bb3865b62bbbd9f9f104d2d190d21ffc 100644 |
| --- a/Source/core/html/HTMLFormControlElement.cpp |
| +++ b/Source/core/html/HTMLFormControlElement.cpp |
| @@ -37,6 +37,7 @@ |
| #include "core/page/ValidationMessageClient.h" |
| #include "core/rendering/RenderBox.h" |
| #include "core/rendering/RenderTheme.h" |
| +#include "platform/text/BidiTextRun.h" |
| #include "wtf/Vector.h" |
| namespace blink { |
| @@ -405,6 +406,20 @@ void HTMLFormControlElement::setNeedsWillValidateCheck() |
| hideVisibleValidationMessage(); |
| } |
| +static void findCustomMessageTextDirection(const Element& anchor, const String& message, TextDirection& messageDir, String& subMessage, TextDirection& subMessageDir) |
| +{ |
| + bool hasStrongDirection; |
| + subMessage = anchor.fastGetAttribute(titleAttr); |
| + messageDir = determineDirectionality(message, hasStrongDirection); |
| + if (!subMessage.isEmpty()) { |
| + // Sub Msg takes direction of the element direction |
|
tkent
2014/07/22 23:56:48
Msg -> message
Habib Virji
2014/07/23 13:32:03
Done.
|
| + subMessageDir = anchor.renderer()->style()->direction(); |
| + AtomicString dir = anchor.fastGetAttribute(dirAttr); |
|
tkent
2014/07/22 23:56:49
Line 417-419 has no effect. It is unnecessary.
Habib Virji
2014/07/23 13:32:03
Done. Removed but it did work correctly if <input
|
| + if (!dir.isEmpty() && equalIgnoringCase(dir, "auto")) |
| + determineDirectionality(message, hasStrongDirection); |
| + } |
| +} |
| + |
| void HTMLFormControlElement::updateVisibleValidationMessage() |
| { |
| Page* page = document().page(); |
| @@ -416,10 +431,14 @@ void HTMLFormControlElement::updateVisibleValidationMessage() |
| m_hasValidationMessage = true; |
| ValidationMessageClient* client = &page->validationMessageClient(); |
| - if (message.isEmpty()) |
| + if (message.isEmpty()) { |
| client->hideValidationMessage(*this); |
| - else |
| - client->showValidationMessage(*this, message); |
| + } else { |
| + TextDirection messageDir, subMessageDir = LTR; |
|
tkent
2014/07/22 23:56:49
We don't declare multiple variables at once.
Habib Virji
2014/07/23 13:32:03
Done.
|
| + String subMessage = String(); |
| + findCustomMessageTextDirection(*this, message, messageDir, subMessage, subMessageDir); |
| + client->showValidationMessage(*this, message, messageDir, subMessage, subMessageDir); |
| + } |
| } |
| void HTMLFormControlElement::hideVisibleValidationMessage() |