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

Unified Diff: Source/core/html/HTMLElement.cpp

Issue 547323005: Implement HTMLElement directionality according to the spec Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index f9dff426403e18215fdd92b3f3597386140f0978..445382ac9026dc4739efd221cd7ada7f6a4e9b86 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -50,6 +50,7 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMenuElement.h"
#include "core/html/HTMLTemplateElement.h"
+#include "core/html/HTMLTextAreaElement.h"
#include "core/html/HTMLTextFormControlElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/rendering/RenderObject.h"
@@ -687,10 +688,20 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
{
if (isHTMLInputElement(*this)) {
HTMLInputElement* inputElement = toHTMLInputElement(const_cast<HTMLElement*>(this));
+ if (inputElement->isTextField() || inputElement->isSearchField()
+ || inputElement->isURLField() || inputElement->isEmailField()) {
+ bool hasStrongDirectionality;
+ TextDirection textDirection = determineDirectionality(inputElement->value(), hasStrongDirectionality);
+ if (strongDirectionalityTextNode)
+ *strongDirectionalityTextNode = hasStrongDirectionality ? inputElement : 0;
+ return textDirection;
+ }
+ } else if (isHTMLTextAreaElement(*this)) {
+ HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(const_cast<HTMLElement*>(this));
bool hasStrongDirectionality;
- TextDirection textDirection = determineDirectionality(inputElement->value(), hasStrongDirectionality);
+ TextDirection textDirection = determineDirectionality(textAreaElement->value(), hasStrongDirectionality);
if (strongDirectionalityTextNode)
- *strongDirectionalityTextNode = hasStrongDirectionality ? inputElement : 0;
+ *strongDirectionalityTextNode = hasStrongDirectionality ? textAreaElement : 0;
return textDirection;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698