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

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: 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 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5405 void Document::defaultEventHandler(Event* event) 5425 void Document::defaultEventHandler(Event* event)
5406 { 5426 {
5407 if (frame() && frame()->remotePlatformLayer()) { 5427 if (frame() && frame()->remotePlatformLayer()) {
5408 frame()->chromeClient().forwardInputEvent(this, event); 5428 frame()->chromeClient().forwardInputEvent(this, event);
5409 return; 5429 return;
5410 } 5430 }
5411 Node::defaultEventHandler(event); 5431 Node::defaultEventHandler(event);
5412 } 5432 }
5413 5433
5414 } // namespace WebCore 5434 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698