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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstChild(*h eadElement)) 1386 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstChild(*h eadElement))
1387 setTitleElement(title->text(), title); 1387 setTitleElement(title->text(), title);
1388 } 1388 }
1389 1389
1390 if (!m_titleElement) 1390 if (!m_titleElement)
1391 updateTitle(String()); 1391 updateTitle(String());
1392 } 1392 }
1393 1393
1394 const AtomicString& Document::dir() 1394 const AtomicString& Document::dir()
1395 { 1395 {
1396 // FIXME(crbug.com/363107): This should be the root html element, not the bo dy. 1396 Element* rootElement = documentElement();
1397 if (HTMLElement* b = body()) 1397 if (isHTMLHtmlElement(rootElement)) {
1398 return b->getAttribute(dirAttr); 1398 // FIXME(crbug.com/363628): document.dir should only return known values .
1399 return rootElement->getAttribute(dirAttr);
1400 }
1399 return nullAtom; 1401 return nullAtom;
1400 } 1402 }
1401 1403
1402 void Document::setDir(const AtomicString& value) 1404 void Document::setDir(const AtomicString& value)
1403 { 1405 {
1404 // FIXME(crbug.com/363107): This should be the root html element, not the bo dy. 1406 Element* rootElement = documentElement();
1405 if (HTMLElement* b = body()) 1407 if (isHTMLHtmlElement(rootElement))
1406 b->setAttribute(dirAttr, value); 1408 rootElement->setAttribute(dirAttr, value);
1407 } 1409 }
1408 1410
1409 PageVisibilityState Document::pageVisibilityState() const 1411 PageVisibilityState Document::pageVisibilityState() const
1410 { 1412 {
1411 // The visibility of the document is inherited from the visibility of the 1413 // The visibility of the document is inherited from the visibility of the
1412 // page. If there is no page associated with the document, we will assume 1414 // page. If there is no page associated with the document, we will assume
1413 // that the page is hidden, as specified by the spec: 1415 // that the page is hidden, as specified by the spec:
1414 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview. html#dom-document-hidden 1416 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview. html#dom-document-hidden
1415 if (!m_frame || !m_frame->page()) 1417 if (!m_frame || !m_frame->page())
1416 return PageVisibilityStateHidden; 1418 return PageVisibilityStateHidden;
(...skipping 4121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 (*it)->invalidateCache(attrName); 5540 (*it)->invalidateCache(attrName);
5539 } 5541 }
5540 5542
5541 void Document::trace(Visitor* visitor) 5543 void Document::trace(Visitor* visitor)
5542 { 5544 {
5543 Supplementable<Document>::trace(visitor); 5545 Supplementable<Document>::trace(visitor);
5544 ContainerNode::trace(visitor); 5546 ContainerNode::trace(visitor);
5545 } 5547 }
5546 5548
5547 } // namespace WebCore 5549 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698