Index: Source/core/html/HTMLElement.cpp |
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp |
index 8eb8c19b2410213c17b090ca9e38f3d5d6fed2ce..efb44044516f3b1dacd2a72a29e508c4f0787018 100644 |
--- a/Source/core/html/HTMLElement.cpp |
+++ b/Source/core/html/HTMLElement.cpp |
@@ -211,10 +211,12 @@ void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name |
if (equalIgnoringCase(value, "auto")) |
addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); |
else { |
- if (isValidDirAttribute(value)) |
+ if (isValidDirAttribute(value)) { |
addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, value); |
- else |
- addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, "ltr"); |
Sunil Ratnu
2014/11/21 12:21:08
Hi tkent, We need to keep this else check here bec
tkent
2014/11/25 01:27:24
I don't think parent lookup is a right solution.
H
Sunil Ratnu
2014/11/25 05:43:25
The above approach does not work here. The above m
tkent
2014/11/25 05:56:09
Please investigate why it didn't work, and find an
|
+ } else { |
+ const AtomicString& dirValue = determineDirection() == RTL ? "rtl" : "ltr"; |
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, dirValue); |
+ } |
if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) |
addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBidi, CSSValueEmbed); |
} |
@@ -715,6 +717,30 @@ TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con |
return directionality(); |
} |
+// FIXME: Implement directionality for input type='tel'. |
+// Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#the-directionality. |
+TextDirection HTMLElement::determineDirection() const |
Sunil Ratnu
2014/11/21 12:21:08
Instead of moving it here, we can also define a ne
|
+{ |
+ 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; |
+} |
+ |
TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) const |
{ |
if (isHTMLInputElement(*this)) { |