⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 187324 in webkit


Ignore:
Timestamp:
Jul 24, 2015, 12:54:42 AM (11 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r187250. rdar://problem/21968460

Location:
branches/safari-601.1-branch/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-601.1-branch/Source/WebKit2/ChangeLog

    r187323 r187324  
     12015-07-24  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r187250. rdar://problem/21968460
     4
     5    2015-07-23  Beth Dakin  <bdakin@apple.com>
     6
     7            Should not allow previews of 1x1 images
     8            https://bugs.webkit.org/show_bug.cgi?id=147237
     9            -and corresponding-
     10            rdar://problem/21968460
     11
     12            Reviewed by Tim Horton.
     13
     14            1x1 images are used on some sites to cover actual images, which leads to a
     15            misleading preview experience. There is not any reason why you would really
     16            want to preview an image this small nor any reason to believe that the
     17            preview would result in anything useful.
     18            * WebProcess/WebPage/ios/WebPageIOS.mm:
     19            (WebKit::WebPage::getPositionInformation):
     20
    1212015-07-24  Matthew Hanson  <matthew_hanson@apple.com>
    222
  • branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r187311 r187324  
    21852185                    auto& renderImage = downcast<RenderImage>(*(element->renderer()));
    21862186                    if (renderImage.cachedImage() && !renderImage.cachedImage()->errorOccurred()) {
    2187                         info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
    21882187                        if (Image* image = renderImage.cachedImage()->imageForRenderer(&renderImage)) {
    2189                             info.isAnimatedImage = image->isAnimated();
    2190                             FloatSize screenSizeInPixels = screenSize();
    2191                             screenSizeInPixels.scale(corePage()->deviceScaleFactor());
    2192                             FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();
    2193                             FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size();
    2194                             if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) {
    2195                                 auto graphicsContext = sharedBitmap->createGraphicsContext();
    2196                                 graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));
    2197                                 info.image = sharedBitmap;
     2188                            if (image->width() > 1 && image->height() > 1) {
     2189                                info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
     2190                                info.isAnimatedImage = image->isAnimated();
     2191                                FloatSize screenSizeInPixels = screenSize();
     2192                                screenSizeInPixels.scale(corePage()->deviceScaleFactor());
     2193                                FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();
     2194                                FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size();
     2195                                if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) {
     2196                                    auto graphicsContext = sharedBitmap->createGraphicsContext();
     2197                                    graphicsContext->drawImage(image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));
     2198                                    info.image = sharedBitmap;
     2199                                }
    21982200                            }
    21992201                        }
Note: See TracChangeset for help on using the changeset viewer.