Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1251 void Document::setContentLanguage(const AtomicString& language) { | 1251 void Document::setContentLanguage(const AtomicString& language) { |
| 1252 if (m_contentLanguage == language) | 1252 if (m_contentLanguage == language) |
| 1253 return; | 1253 return; |
| 1254 m_contentLanguage = language; | 1254 m_contentLanguage = language; |
| 1255 | 1255 |
| 1256 // Document's style depends on the content language. | 1256 // Document's style depends on the content language. |
| 1257 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( | 1257 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( |
| 1258 StyleChangeReason::Language)); | 1258 StyleChangeReason::Language)); |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 const AtomicString& Document::documentLanguage() const { | |
|
dglazkov
2016/12/16 23:00:28
I would avoid adding a new method on Document. Thi
| |
| 1262 Element* htmlElement = documentElement(); | |
| 1263 if (!htmlElement) | |
| 1264 return nullAtom; | |
| 1265 return htmlElement->getAttribute(HTMLNames::langAttr); | |
| 1266 } | |
| 1267 | |
| 1268 Vector<AtomicString> Document::getMetaValues(const AtomicString& name) const { | |
| 1269 Vector<AtomicString> results; | |
| 1270 | |
| 1271 HTMLHeadElement* headElement = head(); | |
| 1272 if (!headElement) | |
| 1273 return results; | |
| 1274 | |
| 1275 for (const HTMLMetaElement& metaElement : | |
| 1276 Traversal<HTMLMetaElement>::childrenOf(*headElement)) { | |
| 1277 if (metaElement.name() != name) | |
| 1278 continue; | |
| 1279 AtomicString content = metaElement.content(); | |
| 1280 if (content.isNull()) | |
| 1281 results.push_back(metaElement.getAttribute(HTMLNames::valueAttr)); | |
| 1282 else | |
| 1283 results.push_back(std::move(content)); | |
| 1284 } | |
| 1285 | |
| 1286 return results; | |
| 1287 } | |
| 1288 | |
| 1261 void Document::setXMLVersion(const String& version, | 1289 void Document::setXMLVersion(const String& version, |
| 1262 ExceptionState& exceptionState) { | 1290 ExceptionState& exceptionState) { |
| 1263 if (!XMLDocumentParser::supportsXMLVersion(version)) { | 1291 if (!XMLDocumentParser::supportsXMLVersion(version)) { |
| 1264 exceptionState.throwDOMException( | 1292 exceptionState.throwDOMException( |
| 1265 NotSupportedError, | 1293 NotSupportedError, |
| 1266 "This document does not support the XML version '" + version + "'."); | 1294 "This document does not support the XML version '" + version + "'."); |
| 1267 return; | 1295 return; |
| 1268 } | 1296 } |
| 1269 | 1297 |
| 1270 m_xmlVersion = version; | 1298 m_xmlVersion = version; |
| (...skipping 5314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6585 } | 6613 } |
| 6586 | 6614 |
| 6587 void showLiveDocumentInstances() { | 6615 void showLiveDocumentInstances() { |
| 6588 WeakDocumentSet& set = liveDocumentSet(); | 6616 WeakDocumentSet& set = liveDocumentSet(); |
| 6589 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6617 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6590 for (Document* document : set) | 6618 for (Document* document : set) |
| 6591 fprintf(stderr, "- Document %p URL: %s\n", document, | 6619 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6592 document->url().getString().utf8().data()); | 6620 document->url().getString().utf8().data()); |
| 6593 } | 6621 } |
| 6594 #endif | 6622 #endif |
| OLD | NEW |