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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 240243004: Update HTMLElement.dir / Document.dir to return only known values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use fastGetAttribute 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #include "core/frame/csp/ContentSecurityPolicy.h" 118 #include "core/frame/csp/ContentSecurityPolicy.h"
119 #include "core/html/HTMLAllCollection.h" 119 #include "core/html/HTMLAllCollection.h"
120 #include "core/html/HTMLAnchorElement.h" 120 #include "core/html/HTMLAnchorElement.h"
121 #include "core/html/HTMLBaseElement.h" 121 #include "core/html/HTMLBaseElement.h"
122 #include "core/html/HTMLCanvasElement.h" 122 #include "core/html/HTMLCanvasElement.h"
123 #include "core/html/HTMLCollection.h" 123 #include "core/html/HTMLCollection.h"
124 #include "core/html/HTMLDialogElement.h" 124 #include "core/html/HTMLDialogElement.h"
125 #include "core/html/HTMLDocument.h" 125 #include "core/html/HTMLDocument.h"
126 #include "core/html/HTMLFrameOwnerElement.h" 126 #include "core/html/HTMLFrameOwnerElement.h"
127 #include "core/html/HTMLHeadElement.h" 127 #include "core/html/HTMLHeadElement.h"
128 #include "core/html/HTMLHtmlElement.h"
128 #include "core/html/HTMLIFrameElement.h" 129 #include "core/html/HTMLIFrameElement.h"
129 #include "core/html/HTMLInputElement.h" 130 #include "core/html/HTMLInputElement.h"
130 #include "core/html/HTMLLinkElement.h" 131 #include "core/html/HTMLLinkElement.h"
131 #include "core/html/HTMLMetaElement.h" 132 #include "core/html/HTMLMetaElement.h"
132 #include "core/html/HTMLNameCollection.h" 133 #include "core/html/HTMLNameCollection.h"
133 #include "core/html/HTMLScriptElement.h" 134 #include "core/html/HTMLScriptElement.h"
134 #include "core/html/HTMLStyleElement.h" 135 #include "core/html/HTMLStyleElement.h"
135 #include "core/html/HTMLTemplateElement.h" 136 #include "core/html/HTMLTemplateElement.h"
136 #include "core/html/HTMLTitleElement.h" 137 #include "core/html/HTMLTitleElement.h"
137 #include "core/html/PluginDocument.h" 138 #include "core/html/PluginDocument.h"
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 setTitleElement(title->text(), title); 1388 setTitleElement(title->text(), title);
1388 } 1389 }
1389 1390
1390 if (!m_titleElement) 1391 if (!m_titleElement)
1391 updateTitle(String()); 1392 updateTitle(String());
1392 } 1393 }
1393 1394
1394 const AtomicString& Document::dir() 1395 const AtomicString& Document::dir()
1395 { 1396 {
1396 Element* rootElement = documentElement(); 1397 Element* rootElement = documentElement();
1397 if (isHTMLHtmlElement(rootElement)) { 1398 if (isHTMLHtmlElement(rootElement))
1398 // FIXME(crbug.com/363628): document.dir should only return known values . 1399 return toHTMLHtmlElement(rootElement)->dir();
1399 return rootElement->getAttribute(dirAttr);
1400 }
1401 return nullAtom; 1400 return nullAtom;
1402 } 1401 }
1403 1402
1404 void Document::setDir(const AtomicString& value) 1403 void Document::setDir(const AtomicString& value)
1405 { 1404 {
1406 Element* rootElement = documentElement(); 1405 Element* rootElement = documentElement();
1407 if (isHTMLHtmlElement(rootElement)) 1406 if (isHTMLHtmlElement(rootElement))
1408 rootElement->setAttribute(dirAttr, value); 1407 toHTMLHtmlElement(rootElement)->setDir(value);
1409 } 1408 }
1410 1409
1411 PageVisibilityState Document::pageVisibilityState() const 1410 PageVisibilityState Document::pageVisibilityState() const
1412 { 1411 {
1413 // The visibility of the document is inherited from the visibility of the 1412 // The visibility of the document is inherited from the visibility of the
1414 // page. If there is no page associated with the document, we will assume 1413 // page. If there is no page associated with the document, we will assume
1415 // that the page is hidden, as specified by the spec: 1414 // that the page is hidden, as specified by the spec:
1416 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview. html#dom-document-hidden 1415 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview. html#dom-document-hidden
1417 if (!m_frame || !m_frame->page()) 1416 if (!m_frame || !m_frame->page())
1418 return PageVisibilityStateHidden; 1417 return PageVisibilityStateHidden;
(...skipping 4138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 (*it)->invalidateCache(attrName); 5556 (*it)->invalidateCache(attrName);
5558 } 5557 }
5559 5558
5560 void Document::trace(Visitor* visitor) 5559 void Document::trace(Visitor* visitor)
5561 { 5560 {
5562 Supplementable<Document>::trace(visitor); 5561 Supplementable<Document>::trace(visitor);
5563 ContainerNode::trace(visitor); 5562 ContainerNode::trace(visitor);
5564 } 5563 }
5565 5564
5566 } // namespace WebCore 5565 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/element-attribute-js-null-expected.txt ('k') | Source/core/html/HTMLElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698