Fixed: <rdar://problem/3937663> repro assertion failure and crash dragging image...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2005 19:41:52 +0000 (19:41 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2005 19:41:52 +0000 (19:41 +0000)
        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

WebKit/ChangeLog
WebKit/Misc.subproj/WebNSViewExtras.m
WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m
WebKit/WebView.subproj/WebImageView.m

index db89ad6f913bbd4dd58534d44e9f5e220c4d5640..7bbed823de290538770ab9d72a4bfc85940ddf41 100644 (file)
@@ -1,3 +1,16 @@
+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.
index da5068b0fac7c982e7be1af9049840e7fde77d63..8db779ae94cde1c3bf829a8625d00603cc6e556d 100644 (file)
     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;
         
index da7ab64c09d0b57b449f4e67c6063f57edacbc3b..5d5267c7beaea2c13c97d227fb70423016e339fb 100644 (file)
@@ -196,12 +196,7 @@ struct CompositeOperator CGCompositeOperations[NUM_COMPOSITE_OPERATORS] = {
 {
     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];
@@ -209,8 +204,7 @@ struct CompositeOperator CGCompositeOperations[NUM_COMPOSITE_OPERATORS] = {
 
         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];
             }
         }
index c75f2e080a991ea99af536d7f8edd8d24f3e4aa9..04416572753eb6a40aa730ee94654ab85b634af6 100644 (file)
 
 + (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