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..d68646f6f6b1a0b3a611fd3f84280d2a3f4ef0d9 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,18 @@ void HTMLFormControlElement::setNeedsWillValidateCheck() |
| hideVisibleValidationMessage(); |
| } |
| +void HTMLFormControlElement::findCustomValidationMessageTextDirection(const String& message, TextDirection &messageDir, String& subMessage, TextDirection &subMessageDir) |
| +{ |
| + bool hasStrongDirection; |
| + subMessage = fastGetAttribute(titleAttr); |
| + messageDir = determineDirectionality(message, hasStrongDirection); |
| + if (!subMessage.isEmpty()) |
| + subMessageDir = renderer()->style()->direction(); |
| + AtomicString dir = fastGetAttribute(dirAttr); |
|
tkent
2014/08/08 01:41:14
Why do you refer to |dir| attribute though we alre
|
| + if (!dir.isEmpty()) |
| + subMessageDir = equalIgnoringCase(dir, "auto") ? determineDirectionality(message, hasStrongDirection): equalIgnoringCase(dir, "ltr") ? LTR: RTL; |
| +} |
| + |
| void HTMLFormControlElement::updateVisibleValidationMessage() |
| { |
| Page* page = document().page(); |
| @@ -416,10 +429,14 @@ void HTMLFormControlElement::updateVisibleValidationMessage() |
| m_hasValidationMessage = true; |
| ValidationMessageClient* client = &page->validationMessageClient(); |
| + TextDirection messageDir = LTR; |
| + TextDirection subMessageDir = LTR; |
| + String subMessage = String(); |
| if (message.isEmpty()) |
| client->hideValidationMessage(*this); |
| else |
| - client->showValidationMessage(*this, message); |
| + findCustomValidationMessageTextDirection(message, messageDir, subMessage, subMessageDir); |
| + client->showValidationMessage(*this, message, messageDir, subMessage, subMessageDir); |
| } |
| void HTMLFormControlElement::hideVisibleValidationMessage() |