Title: [187324] branches/safari-601.1-branch/Source/WebKit2
Revision
187324
Author
[email protected]
Date
2015-07-24 00:54:42 -0700 (Fri, 24 Jul 2015)

Log Message

Merge r187250. rdar://problem/21968460

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187323 => 187324)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:54:40 UTC (rev 187323)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:54:42 UTC (rev 187324)
@@ -1,5 +1,25 @@
 2015-07-24  Matthew Hanson  <[email protected]>
 
+        Merge r187250. rdar://problem/21968460
+
+    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-24  Matthew Hanson  <[email protected]>
+
         Merge r187248. rdar://problem/21949735
 
     2015-07-23  Brady Eidson  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (187323 => 187324)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-07-24 07:54:40 UTC (rev 187323)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-07-24 07:54:42 UTC (rev 187324)
@@ -2184,17 +2184,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

Reply via email to