summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/MIMETypeRegistry.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp
index c5f31407c..39b4344bf 100644
--- a/Source/WebCore/platform/MIMETypeRegistry.cpp
+++ b/Source/WebCore/platform/MIMETypeRegistry.cpp
@@ -245,21 +245,29 @@ static void initializeSupportedImageMIMETypes()
}
#if PLATFORM(QT)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
+ QList<QByteArray> mimeTypes = QImageReader::supportedMimeTypes();
+ Q_FOREACH(const QByteArray& mimeType, mimeTypes) {
+ supportedImageMIMETypes->add(mimeType.constData());
+ supportedImageResourceMIMETypes->add(mimeType.constData());
+ }
+#else
QList<QByteArray> formats = QImageReader::supportedImageFormats();
- for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) {
-#if ENABLE(SVG)
- // Qt has support for SVG, but we want to use KSVG2
- if (formats.at(i).toLower().startsWith("svg"))
- continue;
-#endif // ENABLE(SVG)
+ for (int i = 0; i < formats.size(); ++i) {
String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
if (!mimeType.isEmpty()) {
supportedImageMIMETypes->add(mimeType);
supportedImageResourceMIMETypes->add(mimeType);
}
- }
-#endif // PLATFORM(QT)
+ }
+#endif // QT_VERSION
+#if ENABLE(SVG)
+ // Do not treat SVG as images directly if WebKit can handle them.
+ supportedImageMIMETypes->remove("image/svg+xml");
+ supportedImageResourceMIMETypes->remove("image/svg+xml");
#endif
+#endif // PLATFORM(QT)
+#endif // USE(CG)
}
static void initializeSupportedImageMIMETypesForEncoding()
@@ -284,12 +292,19 @@ static void initializeSupportedImageMIMETypesForEncoding()
supportedImageMIMETypesForEncoding->add("image/gif");
#endif
#elif PLATFORM(QT)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
+ QList<QByteArray> mimeTypes = QImageWriter::supportedMimeTypes();
+ Q_FOREACH(const QByteArray& mimeType, mimeTypes) {
+ supportedImageMIMETypesForEncoding->add(mimeType.constData());
+ }
+#else
QList<QByteArray> formats = QImageWriter::supportedImageFormats();
for (int i = 0; i < formats.size(); ++i) {
String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
if (!mimeType.isEmpty())
supportedImageMIMETypesForEncoding->add(mimeType);
}
+#endif // QT_VERSION
#elif PLATFORM(GTK)
supportedImageMIMETypesForEncoding->add("image/png");
supportedImageMIMETypesForEncoding->add("image/jpeg");