Reviewed by adele.
* Misc.subproj/WebNSViewExtras.m:
(-[NSView _web_dragImage:rect:event:pasteboard:source:offset:]): if [WebImageRenderer image] returns nil, fallback to code that uses a file icon as the drag image
* WebCoreSupport.subproj/WebImageRendererFactory.m:
(-[WebImageRendererFactory supportedMIMETypes]): removed code that omits PDF and PostScript from the list since this omission is only needed in WebImageView
* WebView.subproj/WebImageView.m:
(+[WebImageView supportedImageMIMETypes]): added code that omits PDF and PostScript since we don't want WebImageView to render these types
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8361
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-01-13 Chris Blumenberg <cblu@apple.com>
+
+ Fixed: <rdar://problem/3937663> repro assertion failure and crash dragging image that has PDF source
+
+ Reviewed by adele.
+
+ * Misc.subproj/WebNSViewExtras.m:
+ (-[NSView _web_dragImage:rect:event:pasteboard:source:offset:]): if [WebImageRenderer image] returns nil, fallback to code that uses a file icon as the drag image
+ * WebCoreSupport.subproj/WebImageRendererFactory.m:
+ (-[WebImageRendererFactory supportedMIMETypes]): removed code that omits PDF and PostScript from the list since this omission is only needed in WebImageView
+ * WebView.subproj/WebImageView.m:
+ (+[WebImageView supportedImageMIMETypes]): added code that omits PDF and PostScript since we don't want WebImageView to render these types
+
2005-01-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
NSImage *image;
image = [wir image];
- if ([image size].height * [image size].width <= WebMaxOriginalImageArea) {
+ if (image != nil && [image size].height * [image size].width <= WebMaxOriginalImageArea) {
NSSize originalSize = rect.size;
origin = rect.origin;
{
static NSArray *imageMIMETypes = nil;
- if(!imageMIMETypes){
- NSArray *unsupportedTypes = [NSArray arrayWithObjects:
- @"application/pdf",
- @"application/postscript",
- nil];
-
+ if (imageMIMETypes == nil) {
NSEnumerator *enumerator = [[NSImage imageFileTypes] objectEnumerator];
NSURLFileTypeMappings *mappings = [NSURLFileTypeMappings sharedMappings];
NSMutableSet *mimes = [NSMutableSet set];
while ((type = [enumerator nextObject]) != nil) {
NSString *mime = [mappings MIMETypeForExtension:type];
- if(mime && ![mime isEqualToString:@"application/octet-stream"] &&
- ![unsupportedTypes containsObject:mime]){
+ if (mime != nil && ![mime isEqualToString:@"application/octet-stream"]) {
[mimes addObject:mime];
}
}
+ (NSArray *)supportedImageMIMETypes
{
- return [[WebImageRendererFactory sharedFactory] supportedMIMETypes];
+ static NSMutableArray *imageMIMETypes = nil;
+ if (imageMIMETypes == nil) {
+ imageMIMETypes = [[[WebImageRendererFactory sharedFactory] supportedMIMETypes] mutableCopy];
+ [imageMIMETypes removeObject:@"application/pdf"];
+ [imageMIMETypes removeObject:@"application/postscript"];
+ }
+ return imageMIMETypes;
}
- (id)initWithFrame:(NSRect)frame