ImageSourceCGWin.cpp [plain text]
#include "config.h"
#include "ImageSourceCG.h"
#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
String MIMETypeForImageSourceType(const String& type)
{
String mimeType;
if (int dotLocation = type.reverseFind('.'))
mimeType = "image/" + type.substring(dotLocation + 1);
return mimeType;
}
String preferredExtensionForImageSourceType(const String& type)
{
if (type.isEmpty())
return String();
typedef HashMap<String, String> StringMap;
DEPRECATED_DEFINE_STATIC_LOCAL(StringMap, UTIMap, ());
if (UTIMap.isEmpty()) {
UTIMap.add("public.html", "html");
UTIMap.add("public.jpeg", "jpeg");
UTIMap.add("public.jpeg-2000", "jp2");
UTIMap.add("public.plain-text", "txt");
UTIMap.add("public.png", "png");
UTIMap.add("public.tiff", "tiff");
UTIMap.add("public.xbitmap-image", "xbm");
UTIMap.add("public.xml", "xml");
UTIMap.add("com.adobe.illustrator.ai-image", "ai");
UTIMap.add("com.adobe.pdf", "pdf");
UTIMap.add("com.adobe.photoshop-image", "psd");
UTIMap.add("com.adobe.postscript", "ps");
UTIMap.add("com.apple.icns", "icns");
UTIMap.add("com.apple.macpaint-image", "pntg");
UTIMap.add("com.apple.pict", "pict");
UTIMap.add("com.apple.quicktime-image", "qtif");
UTIMap.add("com.apple.webarchive", "webarchive");
UTIMap.add("com.compuserve.gif", "gif");
UTIMap.add("com.ilm.openexr-image", "exr");
UTIMap.add("com.kodak.flashpix-image", "fpx");
UTIMap.add("com.microsoft.bmp", "bmp");
UTIMap.add("com.microsoft.ico", "ico");
UTIMap.add("com.netscape.javascript-source", "js");
UTIMap.add("com.sgi.sgi-image", "sgi");
UTIMap.add("com.truevision.tga-image", "tga");
}
return UTIMap.get(type);
}
}