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

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

Issue 2577203002: Remove use of WebNode/WebElement in translate_helper (Closed)
Patch Set: Minor changes Created 4 years 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
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 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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 void Document::setContentLanguage(const AtomicString& language) { 1248 void Document::setContentLanguage(const AtomicString& language) {
1249 if (m_contentLanguage == language) 1249 if (m_contentLanguage == language)
1250 return; 1250 return;
1251 m_contentLanguage = language; 1251 m_contentLanguage = language;
1252 1252
1253 // Document's style depends on the content language. 1253 // Document's style depends on the content language.
1254 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( 1254 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(
1255 StyleChangeReason::Language)); 1255 StyleChangeReason::Language));
1256 } 1256 }
1257 1257
1258 const AtomicString& Document::documentLanguage() const {
1259 Element* htmlElement = documentElement();
1260 if (!htmlElement) {
jbroman 2016/12/16 16:17:42 super-nit: You don't need the braces here.
adithyas 2016/12/16 21:57:17 Fixed.
1261 return nullAtom;
1262 }
1263 return htmlElement->getAttribute(HTMLNames::langAttr);
1264 }
1265
1266 Vector<AtomicString> Document::getMetaValues(const AtomicString& name) const {
1267 Vector<AtomicString> results;
1268
1269 HTMLHeadElement* headElement = head();
1270 if (!headElement)
1271 return results;
1272
1273 for (Node* child = headElement->firstChild(); child;
jbroman 2016/12/16 16:17:42 You can use the awesome traversal helpers now that
jbroman 2016/12/16 16:20:05 Or "const auto&" instead of "const HTMLMetaElement
adithyas 2016/12/16 21:57:17 Nice, fixed!
1274 child = child->nextSibling()) {
1275 if (!isHTMLMetaElement(child))
1276 continue;
1277 HTMLMetaElement* metaElement = toHTMLMetaElement(child);
1278 if (metaElement->name() != name)
1279 continue;
1280 AtomicString content = metaElement->content();
1281 if (content.isNull())
1282 results.push_back(metaElement->getAttribute(HTMLNames::valueAttr));
1283 else
1284 results.push_back(content);
jbroman 2016/12/16 16:17:42 super-nit: I believe AtomicString is movable, so y
adithyas 2016/12/16 21:57:17 Done.
1285 }
1286
1287 return results;
1288 }
1289
1258 void Document::setXMLVersion(const String& version, 1290 void Document::setXMLVersion(const String& version,
1259 ExceptionState& exceptionState) { 1291 ExceptionState& exceptionState) {
1260 if (!XMLDocumentParser::supportsXMLVersion(version)) { 1292 if (!XMLDocumentParser::supportsXMLVersion(version)) {
1261 exceptionState.throwDOMException( 1293 exceptionState.throwDOMException(
1262 NotSupportedError, 1294 NotSupportedError,
1263 "This document does not support the XML version '" + version + "'."); 1295 "This document does not support the XML version '" + version + "'.");
1264 return; 1296 return;
1265 } 1297 }
1266 1298
1267 m_xmlVersion = version; 1299 m_xmlVersion = version;
(...skipping 5304 matching lines...) Expand 10 before | Expand all | Expand 10 after
6572 } 6604 }
6573 6605
6574 void showLiveDocumentInstances() { 6606 void showLiveDocumentInstances() {
6575 WeakDocumentSet& set = liveDocumentSet(); 6607 WeakDocumentSet& set = liveDocumentSet();
6576 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6608 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6577 for (Document* document : set) 6609 for (Document* document : set)
6578 fprintf(stderr, "- Document %p URL: %s\n", document, 6610 fprintf(stderr, "- Document %p URL: %s\n", document,
6579 document->url().getString().utf8().data()); 6611 document->url().getString().utf8().data());
6580 } 6612 }
6581 #endif 6613 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698