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

Unified Diff: Source/core/dom/Document.cpp

Issue 235893014: Document.dir should reflect the 'dir' attribute of the root html element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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
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

Powered by Google App Engine
This is Rietveld 408576698