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

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: review comments Created 6 years, 10 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
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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 if (xmlStandalone()) 1214 if (xmlStandalone())
1215 return "text/xml"; 1215 return "text/xml";
1216 if (isHTMLDocument()) 1216 if (isHTMLDocument())
1217 return "text/html"; 1217 return "text/html";
1218 1218
1219 if (DocumentLoader* documentLoader = loader()) 1219 if (DocumentLoader* documentLoader = loader())
1220 return documentLoader->responseMIMEType(); 1220 return documentLoader->responseMIMEType();
1221 return String(); 1221 return String();
1222 } 1222 }
1223 1223
1224 void Document::setMimeType(const AtomicString& mimeType)
1225 {
1226 m_mimeType = mimeType;
1227 }
1228
1229 AtomicString Document::contentType() const
1230 {
1231 if (!m_mimeType.isEmpty())
1232 return m_mimeType;
1233
1234 if (DocumentLoader* documentLoader = loader())
1235 return documentLoader->mimeType();
1236
1237 String mimeType = suggestedMIMEType();
1238 if (!mimeType.isEmpty())
1239 return AtomicString(mimeType);
1240
1241 return AtomicString("application/xml");
1242 }
1243
1224 Element* Document::elementFromPoint(int x, int y) const 1244 Element* Document::elementFromPoint(int x, int y) const
1225 { 1245 {
1226 if (!renderView()) 1246 if (!renderView())
1227 return 0; 1247 return 0;
1228 1248
1229 return TreeScope::elementFromPoint(x, y); 1249 return TreeScope::elementFromPoint(x, y);
1230 } 1250 }
1231 1251
1232 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) 1252 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)
1233 { 1253 {
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 } 3234 }
3215 return create(init); 3235 return create(init);
3216 } 3236 }
3217 3237
3218 void Document::cloneDataFromDocument(const Document& other) 3238 void Document::cloneDataFromDocument(const Document& other)
3219 { 3239 {
3220 setCompatibilityMode(other.compatibilityMode()); 3240 setCompatibilityMode(other.compatibilityMode());
3221 setEncodingData(other.m_encodingData); 3241 setEncodingData(other.m_encodingData);
3222 setContextFeatures(other.contextFeatures()); 3242 setContextFeatures(other.contextFeatures());
3223 setSecurityOrigin(other.securityOrigin()->isolatedCopy()); 3243 setSecurityOrigin(other.securityOrigin()->isolatedCopy());
3244 setMimeType(other.contentType());
3224 } 3245 }
3225 3246
3226 StyleSheetList* Document::styleSheets() 3247 StyleSheetList* Document::styleSheets()
3227 { 3248 {
3228 if (!m_styleSheetList) 3249 if (!m_styleSheetList)
3229 m_styleSheetList = StyleSheetList::create(this); 3250 m_styleSheetList = StyleSheetList::create(this);
3230 return m_styleSheetList.get(); 3251 return m_styleSheetList.get();
3231 } 3252 }
3232 3253
3233 String Document::preferredStylesheetSet() const 3254 String Document::preferredStylesheetSet() const
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5405 void Document::defaultEventHandler(Event* event) 5426 void Document::defaultEventHandler(Event* event)
5406 { 5427 {
5407 if (frame() && frame()->remotePlatformLayer()) { 5428 if (frame() && frame()->remotePlatformLayer()) {
5408 frame()->chromeClient().forwardInputEvent(this, event); 5429 frame()->chromeClient().forwardInputEvent(this, event);
5409 return; 5430 return;
5410 } 5431 }
5411 Node::defaultEventHandler(event); 5432 Node::defaultEventHandler(event);
5412 } 5433 }
5413 5434
5414 } // namespace WebCore 5435 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698