Index: Source/core/html/HTMLElement.cpp |
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp |
index f9dff426403e18215fdd92b3f3597386140f0978..6873b4c6875a3c2672e230b7922c235f5ddebaab 100644 |
--- a/Source/core/html/HTMLElement.cpp |
+++ b/Source/core/html/HTMLElement.cpp |
@@ -190,8 +190,6 @@ void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name |
else { |
if (isValidDirAttribute(value)) |
tkent
2014/09/12 06:33:55
If |value| is "auto", this code sets it to directi
Sunil Ratnu
2014/09/12 07:16:12
I don't think the flow will come here for value 'a
tkent
2014/11/07 01:01:53
Why is it in the else block? Did you look at the
Sunil Ratnu
2014/11/12 13:49:32
Yes, I did take a look at the isValidDirAttribute
tkent
2014/11/19 03:32:19
Ah, you're right. We check "auto" at line 188. S
|
addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, value); |
- else |
- addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, "ltr"); |
if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) |
addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBidi, CSSValueEmbed); |
} |
@@ -683,6 +681,33 @@ TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con |
return directionality(); |
} |
+// FIXME: Implement directionality for input type='tel' when it is supported |
tkent
2014/11/19 03:38:34
type=tel is supported by Google Chrome, IE, Firefo
|
+// [Currently it is not supported in any of the browsers]. |
+// Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#the-directionality |
+TextDirection HTMLElement::determineDirection() const |
+{ |
+ for (const HTMLElement* element = this; element; element = Traversal<HTMLElement>::firstAncestor(*element)) { |
+ const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAttr); |
+ if (dirAttributeValue.isNull()) |
+ continue; |
+ |
+ if (equalIgnoringCase(dirAttributeValue, "rtl")) |
+ return RTL; |
+ |
+ if (equalIgnoringCase(dirAttributeValue, "ltr")) |
+ return LTR; |
+ |
+ if (equalIgnoringCase(dirAttributeValue, "auto")) { |
+ bool isAuto; |
+ return element->directionalityIfhasDirAutoAttribute(isAuto); |
+ } |
+ } |
+ |
+ return LTR; |
+} |
+ |
+// FIXME: This implementation deviates from the spec in case of 'textarea' having 'auto' attribute. |
+// Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#the-directionality |
TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) const |
{ |
if (isHTMLInputElement(*this)) { |