Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index 4ae2e5d3a125ab92f99efd46fe859e6352e0f4ae..eba4c90a4be4051a48900e0134e01947de043c12 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -3640,6 +3640,31 @@ bool Element::supportsStyleSharing() const |
return true; |
} |
+TextDirection Element::directionality() const |
+{ |
+ if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) { |
+ CachedTextDirection direction = const_cast<Element*>(this)->ensureUniqueElementData().directionality(); |
+ if (direction == CachedTextDirection::NotAutoOrNotCached) { |
+ toHTMLElement(this)->cacheDirectionalityForDirAuto(); |
+ direction = elementData()->directionality(); |
+ DCHECK(direction != CachedTextDirection::NotAutoOrNotCached); |
+ } |
+ if (direction == CachedTextDirection::AutoLTR) |
+ return LTR; |
+ return RTL; |
+ } |
+ |
+ if (equalIgnoringCase(fastGetAttribute(dirAttr), "ltr")) |
+ return LTR; |
+ if (equalIgnoringCase(fastGetAttribute(dirAttr), "rtl")) |
+ return RTL; |
+ |
+ const Element* parent = FlatTreeTraversal::parentElement(*this); |
+ if (parent) |
+ return parent->directionality(); |
+ return LTR; |
+} |
+ |
void Element::logAddElementIfIsolatedWorldAndInDocument(const char element[], const QualifiedName& attr1) |
{ |
if (!inShadowIncludingDocument()) |