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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2577203002: Remove use of WebNode/WebElement in translate_helper (Closed)
Patch Set: Add WebLanguageDetectionDetails 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 ada10d8cd839af05103b6d214ea3b6045d82de1a..6d746fffdeb9816d7a33d5ed9751035344d1d06d 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1258,6 +1258,34 @@ void Document::setContentLanguage(const AtomicString& language) {
StyleChangeReason::Language));
}
+const AtomicString& Document::documentLanguage() const {
dglazkov 2016/12/16 23:00:28 I would avoid adding a new method on Document. Thi
+ Element* htmlElement = documentElement();
+ if (!htmlElement)
+ 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 (const HTMLMetaElement& metaElement :
+ Traversal<HTMLMetaElement>::childrenOf(*headElement)) {
+ if (metaElement.name() != name)
+ continue;
+ AtomicString content = metaElement.content();
+ if (content.isNull())
+ results.push_back(metaElement.getAttribute(HTMLNames::valueAttr));
+ else
+ results.push_back(std::move(content));
+ }
+
+ return results;
+}
+
void Document::setXMLVersion(const String& version,
ExceptionState& exceptionState) {
if (!XMLDocumentParser::supportsXMLVersion(version)) {

Powered by Google App Engine
This is Rietveld 408576698