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

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

Issue 151653004: Implemented Document.contentType (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase and fixing tests on windows Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index adb5aa2c44ad394a0a821dae999404196a3ab5e2..12bbc252ceb4e3690d0b33a5652b43af9944109d 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1203,6 +1203,26 @@ String Document::suggestedMIMEType() const
return String();
}
+void Document::setMimeType(const AtomicString& mimeType)
+{
+ m_mimeType = mimeType;
+}
+
+AtomicString Document::contentType() const
+{
+ if (!m_mimeType.isEmpty())
+ return m_mimeType;
+
+ if (DocumentLoader* documentLoader = loader())
+ return documentLoader->mimeType();
+
+ String mimeType = suggestedMIMEType();
+ if (!mimeType.isEmpty())
+ return AtomicString(mimeType);
+
+ return AtomicString("application/xml");
+}
+
Element* Document::elementFromPoint(int x, int y) const
{
if (!renderView())
@@ -3259,6 +3279,7 @@ void Document::cloneDataFromDocument(const Document& other)
setEncodingData(other.m_encodingData);
setContextFeatures(other.contextFeatures());
setSecurityOrigin(other.securityOrigin()->isolatedCopy());
+ setMimeType(other.contentType());
}
StyleSheetList* Document::styleSheets()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698