Don't attempt wide gammut on older OSes
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 23:21:34 +0000 (23:21 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 23:21:34 +0000 (23:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167754
<rdar://problem/29931587>

Reviewed by Tim Horton.

We need to guard our extended color checks the same way throughout the code, or we will attempt to set up
support for wide gamut partially, which causes crashes when using sharable bitmap.

* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211601 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index d6d2a5e..158aee9 100644 (file)
@@ -1,3 +1,19 @@
+2017-02-02  Megan Gardner  <megan_gardner@apple.com>
+
+        Don't attempt wide gammut on older OSes
+        https://bugs.webkit.org/show_bug.cgi?id=167754
+        <rdar://problem/29931587>
+
+        Reviewed by Tim Horton.
+
+        We need to guard our extended color checks the same way throughout the code, or we will attempt to set up
+        support for wide gamut partially, which causes crashes when using sharable bitmap.
+
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::convertImageToBitmap):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getPositionInformation):
+
 2017-02-02  Enrica Casucci  <enrica@apple.com>
 
         WK2: cannot tap on candidate view with hardware keyboard.
index 69d7463..b3c6dca 100644 (file)
@@ -62,8 +62,10 @@ namespace WebKit {
 static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const IntSize& size, Frame& frame)
 {
     ShareableBitmap::Flags flags = ShareableBitmap::SupportsAlpha;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     if (screenSupportsExtendedColor(frame.mainFrame().view()))
         flags |= ShareableBitmap::SupportsExtendedColor;
+#endif
     auto bitmap = ShareableBitmap::createShareable(size, flags);
     if (!bitmap)
         return nullptr;
index 0b4861d..2d95043 100644 (file)
@@ -2488,7 +2488,9 @@ void WebPage::getPositionInformation(const InteractionInformationRequest& reques
                                     FloatSize bitmapSize = scaledSize.width() < image->size().width() ? scaledSize : image->size();
                                     // FIXME: Only select ExtendedColor on images known to need wide gamut
                                     ShareableBitmap::Flags flags = ShareableBitmap::SupportsAlpha;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
                                     flags |= screenSupportsExtendedColor() ? ShareableBitmap::SupportsExtendedColor : 0;
+#endif
                                     if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), flags)) {
                                         auto graphicsContext = sharedBitmap->createGraphicsContext();
                                         graphicsContext->drawImage(*image, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));