Changeset 187250 in webkit
- Timestamp:
- Jul 23, 2015, 1:53:47 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r187248 r187250 1 2015-07-23 Beth Dakin <bdakin@apple.com> 2 3 Should not allow previews of 1x1 images 4 https://bugs.webkit.org/show_bug.cgi?id=147237 5 -and corresponding- 6 rdar://problem/21968460 7 8 Reviewed by Tim Horton. 9 10 1x1 images are used on some sites to cover actual images, which leads to a 11 misleading preview experience. There is not any reason why you would really 12 want to preview an image this small nor any reason to believe that the 13 preview would result in anything useful. 14 * WebProcess/WebPage/ios/WebPageIOS.mm: 15 (WebKit::WebPage::getPositionInformation): 16 1 17 2015-07-23 Brady Eidson <beidson@apple.com> 2 18 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r187220 r187250 2222 2222 auto& renderImage = downcast<RenderImage>(*(element->renderer())); 2223 2223 if (renderImage.cachedImage() && !renderImage.cachedImage()->errorOccurred()) { 2224 info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];2225 2224 if (Image* image = renderImage.cachedImage()->imageForRenderer(&renderImage)) { 2226 info.isAnimatedImage = image->isAnimated(); 2227 FloatSize screenSizeInPixels = screenSize(); 2228 screenSizeInPixels.scale(corePage()->deviceScaleFactor()); 2229 FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size(); 2230 FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size(); 2231 if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) { 2232 auto graphicsContext = sharedBitmap->createGraphicsContext(); 2233 graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height())); 2234 info.image = sharedBitmap; 2225 if (image->width() > 1 && image->height() > 1) { 2226 info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString]; 2227 info.isAnimatedImage = image->isAnimated(); 2228 FloatSize screenSizeInPixels = screenSize(); 2229 screenSizeInPixels.scale(corePage()->deviceScaleFactor()); 2230 FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size(); 2231 FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size(); 2232 if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) { 2233 auto graphicsContext = sharedBitmap->createGraphicsContext(); 2234 graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height())); 2235 info.image = sharedBitmap; 2236 } 2235 2237 } 2236 2238 }
Note:
See TracChangeset
for help on using the changeset viewer.