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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 733298fd28a216b3496cf0b0ba58fabbf04d3dc4..a9b7d6d5193abfb83a9f9eda24a8a41cb536fe3f 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1255,6 +1255,38 @@ void Document::setContentLanguage(const AtomicString& language) {
StyleChangeReason::Language));
}
+const AtomicString& Document::documentLanguage() const {
+ Element* htmlElement = documentElement();
+ 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.
+ return nullAtom;
+ }
+ return htmlElement->getAttribute(HTMLNames::langAttr);
+}
+
+Vector<AtomicString> Document::getMetaValues(const AtomicString& name) const {
+ Vector<AtomicString> results;
+
+ HTMLHeadElement* headElement = head();
+ if (!headElement)
+ return results;
+
+ 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!
+ child = child->nextSibling()) {
+ if (!isHTMLMetaElement(child))
+ continue;
+ HTMLMetaElement* metaElement = toHTMLMetaElement(child);
+ if (metaElement->name() != name)
+ continue;
+ AtomicString content = metaElement->content();
+ if (content.isNull())
+ results.push_back(metaElement->getAttribute(HTMLNames::valueAttr));
+ else
+ 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.
+ }
+
+ return results;
+}
+
void Document::setXMLVersion(const String& version,
ExceptionState& exceptionState) {
if (!XMLDocumentParser::supportsXMLVersion(version)) {

Powered by Google App Engine
This is Rietveld 408576698