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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 if (xmlStandalone()) 1196 if (xmlStandalone())
1197 return "text/xml"; 1197 return "text/xml";
1198 if (isHTMLDocument()) 1198 if (isHTMLDocument())
1199 return "text/html"; 1199 return "text/html";
1200 1200
1201 if (DocumentLoader* documentLoader = loader()) 1201 if (DocumentLoader* documentLoader = loader())
1202 return documentLoader->responseMIMEType(); 1202 return documentLoader->responseMIMEType();
1203 return String(); 1203 return String();
1204 } 1204 }
1205 1205
1206 void Document::setMimeType(const AtomicString& mimeType)
1207 {
1208 m_mimeType = mimeType;
1209 }
1210
1211 AtomicString Document::contentType() const
1212 {
1213 if (!m_mimeType.isEmpty())
1214 return m_mimeType;
1215
1216 if (DocumentLoader* documentLoader = loader())
1217 return documentLoader->mimeType();
1218
1219 String mimeType = suggestedMIMEType();
1220 if (!mimeType.isEmpty())
1221 return AtomicString(mimeType);
1222
1223 return AtomicString("application/xml");
1224 }
1225
1206 Element* Document::elementFromPoint(int x, int y) const 1226 Element* Document::elementFromPoint(int x, int y) const
1207 { 1227 {
1208 if (!renderView()) 1228 if (!renderView())
1209 return 0; 1229 return 0;
1210 1230
1211 return TreeScope::elementFromPoint(x, y); 1231 return TreeScope::elementFromPoint(x, y);
1212 } 1232 }
1213 1233
1214 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) 1234 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)
1215 { 1235 {
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 } 3272 }
3253 return create(init); 3273 return create(init);
3254 } 3274 }
3255 3275
3256 void Document::cloneDataFromDocument(const Document& other) 3276 void Document::cloneDataFromDocument(const Document& other)
3257 { 3277 {
3258 setCompatibilityMode(other.compatibilityMode()); 3278 setCompatibilityMode(other.compatibilityMode());
3259 setEncodingData(other.m_encodingData); 3279 setEncodingData(other.m_encodingData);
3260 setContextFeatures(other.contextFeatures()); 3280 setContextFeatures(other.contextFeatures());
3261 setSecurityOrigin(other.securityOrigin()->isolatedCopy()); 3281 setSecurityOrigin(other.securityOrigin()->isolatedCopy());
3282 setMimeType(other.contentType());
3262 } 3283 }
3263 3284
3264 StyleSheetList* Document::styleSheets() 3285 StyleSheetList* Document::styleSheets()
3265 { 3286 {
3266 if (!m_styleSheetList) 3287 if (!m_styleSheetList)
3267 m_styleSheetList = StyleSheetList::create(this); 3288 m_styleSheetList = StyleSheetList::create(this);
3268 return m_styleSheetList.get(); 3289 return m_styleSheetList.get();
3269 } 3290 }
3270 3291
3271 String Document::preferredStylesheetSet() const 3292 String Document::preferredStylesheetSet() const
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5491 } 5512 }
5492 5513
5493 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5514 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5494 { 5515 {
5495 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5516 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5496 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5517 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5497 (*it)->invalidateCache(attrName); 5518 (*it)->invalidateCache(attrName);
5498 } 5519 }
5499 5520
5500 } // namespace WebCore 5521 } // namespace WebCore
OLDNEW
« 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