Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 78528d6ab6762d5014ae714718921f8a75c17f52..aea2e4969b5f2e4a9722120273dc1168e5b95c9c 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -1393,17 +1393,19 @@ void Document::removeTitle(Element* titleElement) |
const AtomicString& Document::dir() |
{ |
- // FIXME(crbug.com/363107): This should be the root html element, not the body. |
- if (HTMLElement* b = body()) |
- return b->getAttribute(dirAttr); |
+ Element* rootElement = documentElement(); |
+ if (isHTMLHtmlElement(rootElement)) { |
+ // FIXME(crbug.com/363628): document.dir should only return known values. |
+ return rootElement->getAttribute(dirAttr); |
+ } |
return nullAtom; |
} |
void Document::setDir(const AtomicString& value) |
{ |
- // FIXME(crbug.com/363107): This should be the root html element, not the body. |
- if (HTMLElement* b = body()) |
- b->setAttribute(dirAttr, value); |
+ Element* rootElement = documentElement(); |
+ if (isHTMLHtmlElement(rootElement)) |
+ rootElement->setAttribute(dirAttr, value); |
} |
PageVisibilityState Document::pageVisibilityState() const |