Changeset 206683 in webkit
- Timestamp:
- Sep 30, 2016, 3:30:20 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206681 r206683 1 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 The dragged image should be the current frame only of the animated image 4 https://bugs.webkit.org/show_bug.cgi?id=162109 5 6 Reviewed by Tim Horton. 7 8 Instead of creating an NSImage with all the frames for the dragImage, 9 create an NSImage with the current frame only. 10 11 * dom/DataTransferMac.mm: 12 (WebCore::DataTransfer::createDragImage): Call currentFrameNSImage() to create the dragImage. 13 * editing/cocoa/HTMLConverter.mm: 14 (fileWrapperForElement): Call the Image function with its new name. 15 * platform/graphics/BitmapImage.h: 16 * platform/graphics/Image.h: 17 (WebCore::Image::nsImage): Rename getNSImage() to nsImage(). 18 (WebCore::Image::currentFrameNSImage): Returns the NSImage of the current frame. 19 (WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). 20 (WebCore::Image::getNSImage): Deleted. 21 (WebCore::Image::getTIFFRepresentation): Deleted. 22 * platform/graphics/mac/ImageMac.mm: 23 (WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). 24 (WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage(). 25 (WebCore::BitmapImage::currentFrameNSImage): Returns the NSImage of the current frame. 26 (WebCore::BitmapImage::getTIFFRepresentation): Deleted. 27 (WebCore::BitmapImage::getNSImage): Deleted. 28 * platform/mac/CursorMac.mm: 29 (WebCore::createCustomCursor): Call currentFrameNSImage() since the cursor does not animate anyway. 30 * platform/mac/DragImageMac.mm: 31 (WebCore::createDragImageFromImage): Use currentFrameNSImage() for the dragImage. 32 * platform/mac/PasteboardMac.mm: 33 (WebCore::Pasteboard::write): Call the Image function with its new name. 34 1 35 2016-09-30 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebCore/dom/DataTransferMac.mm
r166965 r206683 50 50 } 51 51 } else if (m_dragImage) { 52 result = m_dragImage->image()-> getNSImage();52 result = m_dragImage->image()->currentFrameNSImage(); 53 53 54 54 location = m_dragLocation; -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r202863 r206683 2465 2465 auto* image = downcast<RenderImage>(*renderer).cachedImage(); 2466 2466 if (image && !image->errorOccurred()) { 2467 RetainPtr<NSFileWrapper> wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:(NSData *)image->imageForRenderer(renderer)-> getTIFFRepresentation()]);2467 RetainPtr<NSFileWrapper> wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:(NSData *)image->imageForRenderer(renderer)->tiffRepresentation()]); 2468 2468 [wrapper setPreferredFilename:@"image.tiff"]; 2469 2469 return wrapper; -
trunk/Source/WebCore/platform/graphics/BitmapImage.h
r206631 r206683 97 97 // Accessors for native image formats. 98 98 #if USE(APPKIT) 99 NSImage* getNSImage() override; 99 NSImage *nsImage() override; 100 RetainPtr<NSImage> currentFrameNSImage() override; 100 101 #endif 101 102 102 103 #if PLATFORM(COCOA) 103 CFDataRef getTIFFRepresentation() override;104 CFDataRef tiffRepresentation() override; 104 105 #endif 105 106 … … 192 193 193 194 #if USE(APPKIT) 194 mutable RetainPtr<NSImage> m_nsImage; // A cached NSImage of frame 0. Only built lazily if someone actually queries for one.195 mutable RetainPtr<NSImage> m_nsImage; // A cached NSImage of all the frames. Only built lazily if someone actually queries for one. 195 196 #endif 196 197 #if USE(CG) 197 mutable RetainPtr<CFDataRef> m_tiffRep; // Cached TIFF rep for frame 0. Only built lazily if someone queries for one.198 mutable RetainPtr<CFDataRef> m_tiffRep; // Cached TIFF rep for all the frames. Only built lazily if someone queries for one. 198 199 #endif 199 200 RefPtr<Image> m_cachedImage; -
trunk/Source/WebCore/platform/graphics/Image.h
r206631 r206683 147 147 148 148 #if USE(APPKIT) 149 virtual NSImage* getNSImage() { return nullptr; } 149 virtual NSImage *nsImage() { return nullptr; } 150 virtual RetainPtr<NSImage> currentFrameNSImage() { return nullptr; } 150 151 #endif 151 152 152 153 #if PLATFORM(COCOA) 153 virtual CFDataRef getTIFFRepresentation() { return nullptr; }154 virtual CFDataRef tiffRepresentation() { return nullptr; } 154 155 #endif 155 156 -
trunk/Source/WebCore/platform/graphics/mac/ImageMac.mm
r206481 r206683 75 75 } 76 76 77 CFDataRef BitmapImage:: getTIFFRepresentation()77 CFDataRef BitmapImage::tiffRepresentation() 78 78 { 79 79 if (m_tiffRep) 80 80 return m_tiffRep.get(); 81 81 82 auto nativeImages = this->framesNativeImages();82 auto nativeImages = framesNativeImages(); 83 83 84 // If framesImages.size() is zero, we know for certain this image doesn't have valid data84 // If nativeImages.size() is zero, we know for certain this image doesn't have valid data 85 85 // Even though the call to CGImageDestinationCreateWithData will fail and we'll handle it gracefully, 86 86 // in certain circumstances that call will spam the console with an error message … … 104 104 105 105 #if USE(APPKIT) 106 NSImage* BitmapImage:: getNSImage()106 NSImage* BitmapImage::nsImage() 107 107 { 108 108 if (m_nsImage) 109 109 return m_nsImage.get(); 110 110 111 CFDataRef data = getTIFFRepresentation();111 CFDataRef data = tiffRepresentation(); 112 112 if (!data) 113 return 0;113 return nullptr; 114 114 115 115 m_nsImage = adoptNS([[NSImage alloc] initWithData:(NSData*)data]); 116 116 return m_nsImage.get(); 117 117 } 118 119 RetainPtr<NSImage> BitmapImage::currentFrameNSImage() 120 { 121 auto nativeImage = this->nativeImageForCurrentFrame(); 122 if (!nativeImage) 123 return nullptr; 124 125 return adoptNS([[NSImage alloc] initWithCGImage:nativeImage.get() size:NSZeroSize]); 126 } 118 127 #endif 119 128 -
trunk/Source/WebCore/platform/mac/CursorMac.mm
r201038 r206683 49 49 { 50 50 // FIXME: The cursor won't animate. Not sure if that's a big deal. 51 NSImage* nsImage = image->getNSImage();51 auto nsImage = image->currentFrameNSImage(); 52 52 if (!nsImage) 53 return 0;53 return nullptr; 54 54 BEGIN_BLOCK_OBJC_EXCEPTIONS; 55 55 … … 79 79 #endif 80 80 81 return adoptNS([[NSCursor alloc] initWithImage:nsImage hotSpot:hotSpot]);81 return adoptNS([[NSCursor alloc] initWithImage:nsImage.get() hotSpot:hotSpot]); 82 82 END_BLOCK_OBJC_EXCEPTIONS; 83 83 return nullptr; -
trunk/Source/WebCore/platform/mac/DragImageMac.mm
r200070 r206683 122 122 #pragma clang diagnostic push 123 123 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 124 [image-> getNSImage() drawInRect:destRect fromRect:NSMakeRect(0, 0, size.width(), size.height()) operation:NSCompositeSourceOver fraction:1.0];124 [image->currentFrameNSImage() drawInRect:destRect fromRect:NSMakeRect(0, 0, size.width(), size.height()) operation:NSCompositeSourceOver fraction:1.0]; 125 125 #pragma clang diagnostic pop 126 126 [rotatedDragImage.get() unlockFocus]; … … 130 130 } 131 131 132 RetainPtr<NSImage> dragImage = adoptNS([image->getNSImage() copy]);132 auto dragImage = image->currentFrameNSImage(); 133 133 [dragImage.get() setSize:(NSSize)size]; 134 134 return dragImage; -
trunk/Source/WebCore/platform/mac/PasteboardMac.mm
r203109 r206683 256 256 void Pasteboard::write(const PasteboardImage& pasteboardImage) 257 257 { 258 CFDataRef imageData = pasteboardImage.image-> getTIFFRepresentation();258 CFDataRef imageData = pasteboardImage.image->tiffRepresentation(); 259 259 if (!imageData) 260 260 return; -
trunk/Source/WebKit/mac/ChangeLog
r206440 r206683 1 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 The dragged image should be the current frame only of the animated image 4 https://bugs.webkit.org/show_bug.cgi?id=162109 5 6 Reviewed by Tim Horton. 7 8 * DOM/DOM.mm: 9 (-[DOMElement image]): Call the Image function with its new name. 10 (-[DOMElement _imageTIFFRepresentation]): Ditto. 11 * Misc/WebElementDictionary.mm: 12 (-[WebElementDictionary _image]): Call the Image function with its new name. 13 * Misc/WebIconDatabase.mm: 14 (-[WebIconDatabase defaultIconWithSize:]): Call currentFrameNSImage() to create the icon image. 15 (webGetNSImage): Call the Image function with its new name. 16 * WebCoreSupport/WebContextMenuClient.mm: 17 (WebContextMenuClient::imageForCurrentSharingServicePickerItem): Call currentFrameNSImage() instead of nsImage().. 18 (WebContextMenuClient::contextMenuForEvent): Ditto. 19 * WebView/WebHTMLView.mm: 20 (-[WebHTMLView pasteboard:provideDataForType:]): Call the Image function with its new name. 21 1 22 2016-09-27 Jer Noble <jer.noble@apple.com> 2 23 -
trunk/Source/WebKit/mac/DOM/DOM.mm
r205682 r206683 671 671 if (!cachedImage || cachedImage->errorOccurred()) 672 672 return nil; 673 return cachedImage->imageForRenderer(renderer)-> getNSImage();673 return cachedImage->imageForRenderer(renderer)->nsImage(); 674 674 } 675 675 … … 699 699 if (!cachedImage || cachedImage->errorOccurred()) 700 700 return nil; 701 return (NSData *)cachedImage->imageForRenderer(renderer)-> getTIFFRepresentation();701 return (NSData *)cachedImage->imageForRenderer(renderer)->tiffRepresentation(); 702 702 } 703 703 -
trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm
r193378 r206683 205 205 { 206 206 Image* image = _result->image(); 207 return image ? image-> getNSImage() : nil;207 return image ? image->nsImage() : nil; 208 208 } 209 209 -
trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm
r184853 r206683 164 164 165 165 Image* image = iconDatabase().defaultIcon(IntSize(size)); 166 return image ? image-> getNSImage() : nil;166 return image ? image->currentFrameNSImage().autorelease() : nil; 167 167 } 168 168 … … 471 471 if (!image) 472 472 return nil; 473 NSImage* nsImage = image-> getNSImage();473 NSImage* nsImage = image->nsImage(); 474 474 if (!nsImage) 475 475 return nil; -
trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
r199692 r206683 227 227 return nil; 228 228 229 return [[image->getNSImage() retain] autorelease];229 return image->currentFrameNSImage(); 230 230 } 231 231 #endif … … 243 243 ASSERT(page->contextMenuController().context().hitTestResult().innerNode()); 244 244 245 RetainPtr<NSItemProvider> itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:image-> getNSImage() typeIdentifier:@"public.image"]);245 RetainPtr<NSItemProvider> itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:image->currentFrameNSImage().autorelease() typeIdentifier:@"public.image"]); 246 246 247 247 bool isContentEditable = page->contextMenuController().context().hitTestResult().innerNode()->isContentEditable(); -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r206361 r206683 2211 2211 } else if ([type isEqual:NSTIFFPboardType] && [self promisedDragTIFFDataSource]) { 2212 2212 if (Image* image = [self promisedDragTIFFDataSource]->image()) 2213 [pasteboard setData:(NSData *)image-> getTIFFRepresentation() forType:NSTIFFPboardType];2213 [pasteboard setData:(NSData *)image->tiffRepresentation() forType:NSTIFFPboardType]; 2214 2214 [self setPromisedDragTIFFDataSource:0]; 2215 2215 } -
trunk/Source/WebKit2/ChangeLog
r206675 r206683 1 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 The dragged image should be the current frame only of the animated image 4 https://bugs.webkit.org/show_bug.cgi?id=162109 5 6 Reviewed by Tim Horton. 7 8 * UIProcess/Cocoa/WebViewImpl.mm: 9 (WebKit::WebViewImpl::provideDataForPasteboard): Call the Image function with its new name. 10 1 11 2016-09-30 Anders Carlsson <andersca@apple.com> 2 12 -
trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm
r206033 r206683 3039 3039 3040 3040 if ([type isEqual:NSTIFFPboardType] && m_promisedImage) { 3041 [pasteboard setData:(NSData *)m_promisedImage-> getTIFFRepresentation() forType:NSTIFFPboardType];3041 [pasteboard setData:(NSData *)m_promisedImage->tiffRepresentation() forType:NSTIFFPboardType]; 3042 3042 m_promisedImage = nullptr; 3043 3043 }
Note:
See TracChangeset
for help on using the changeset viewer.