Title: [187250] trunk/Source/WebKit2
- Revision
- 187250
- Author
- [email protected]
- Date
- 2015-07-23 13:53:47 -0700 (Thu, 23 Jul 2015)
Log Message
Should not allow previews of 1x1 images
https://bugs.webkit.org/show_bug.cgi?id=147237
-and corresponding-
rdar://problem/21968460
Reviewed by Tim Horton.
1x1 images are used on some sites to cover actual images, which leads to a
misleading preview experience. There is not any reason why you would really
want to preview an image this small nor any reason to believe that the
preview would result in anything useful.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (187249 => 187250)
--- trunk/Source/WebKit2/ChangeLog 2015-07-23 20:24:08 UTC (rev 187249)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-23 20:53:47 UTC (rev 187250)
@@ -1,3 +1,19 @@
+2015-07-23 Beth Dakin <[email protected]>
+
+ Should not allow previews of 1x1 images
+ https://bugs.webkit.org/show_bug.cgi?id=147237
+ -and corresponding-
+ rdar://problem/21968460
+
+ Reviewed by Tim Horton.
+
+ 1x1 images are used on some sites to cover actual images, which leads to a
+ misleading preview experience. There is not any reason why you would really
+ want to preview an image this small nor any reason to believe that the
+ preview would result in anything useful.
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::getPositionInformation):
+
2015-07-23 Brady Eidson <[email protected]>
Crash in WebPlatformStrategies::createPingHandle - Deref a null NetworkingContext.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (187249 => 187250)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-23 20:24:08 UTC (rev 187249)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-23 20:53:47 UTC (rev 187250)
@@ -2221,17 +2221,19 @@
} else if (element->renderer() && element->renderer()->isRenderImage()) {
auto& renderImage = downcast<RenderImage>(*(element->renderer()));
if (renderImage.cachedImage() && !renderImage.cachedImage()->errorOccurred()) {
- info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
if (Image* image = renderImage.cachedImage()->imageForRenderer(&renderImage)) {
- info.isAnimatedImage = image->isAnimated();
- FloatSize screenSizeInPixels = screenSize();
- screenSizeInPixels.scale(corePage()->deviceScaleFactor());
- FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();
- FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size();
- if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) {
- auto graphicsContext = sharedBitmap->createGraphicsContext();
- graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));
- info.image = sharedBitmap;
+ if (image->width() > 1 && image->height() > 1) {
+ info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
+ info.isAnimatedImage = image->isAnimated();
+ FloatSize screenSizeInPixels = screenSize();
+ screenSizeInPixels.scale(corePage()->deviceScaleFactor());
+ FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();
+ FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size();
+ if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) {
+ auto graphicsContext = sharedBitmap->createGraphicsContext();
+ graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));
+ info.image = sharedBitmap;
+ }
}
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes