Changeset 202867 in webkit


Ignore:
Timestamp:
Jul 6, 2016 11:46:51 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

<img> with a wide gamut PDF does not display using a wide gamut color space
https://bugs.webkit.org/show_bug.cgi?id=158983
<rdar://problem/25720247>

Patch by Antoine Quint <Antoine Quint> on 2016-07-06
Reviewed by Tim Horton.

Source/WebCore:

Calls to ImageBuffer::createCompatibleBuffer() that do not provide an explicit
color space will now infer the color space from the provided graphics context
on platforms using CG. The method signature that takes in a GraphicsContext
without a color space is now split into a CG-specified implementation and a
Cairo one to avoid having diverging platform code in ImageBuffer.cpp.

Some call sites need to provide an explicit color space still, so we add a new
ImageBuffer::createCompatibleBuffer() that allows for that while inferring
sizing and scaling from a GraphicsContext.

All signatures of ImageBuffer::createCompatibleBuffer() are losing the
hasAlpha parameter which was always ignored. All call sites that were using
hasAlpha have been updated.

In addition, we make all the IOSurface and IOSurfacePool code, which is
CG-specific, use the plaform-specific type CGColorSpaceRef instead of ColorSpace
so that we may pick up on the color space copied over from the graphics context
in the CG-specific implementation of ImageBuffer::createCompatibleBuffer().

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::drawTextInternal):

  • platform/graphics/GradientImage.cpp:

(WebCore::GradientImage::drawPattern):

  • platform/graphics/ImageBuffer.cpp:

(WebCore::ImageBuffer::createCompatibleBuffer):

  • platform/graphics/ImageBuffer.h:
  • platform/graphics/NamedImageGeneratedImage.cpp:

(WebCore::NamedImageGeneratedImage::drawPattern):

  • platform/graphics/cairo/ImageBufferCairo.cpp:

(WebCore::ImageBuffer::createCompatibleBuffer):

  • platform/graphics/cg/IOSurfacePool.cpp:

(WebCore::surfaceMatchesParameters):
(WebCore::IOSurfacePool::takeSurface):

  • platform/graphics/cg/IOSurfacePool.h:
  • platform/graphics/cg/ImageBufferCG.cpp:

(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::ImageBuffer):

  • platform/graphics/cocoa/IOSurface.h:
  • platform/graphics/cocoa/IOSurface.mm:

(WebCore::IOSurface::surfaceFromPool):
(WebCore::IOSurface::create):
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::createFromImage):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::ensurePlatformContext):

  • platform/mac/ThemeMac.mm:

(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):

  • platform/spi/cg/CoreGraphicsSPI.h:
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintProgressBar):

  • rendering/svg/SVGRenderingContext.cpp:

(WebCore::SVGRenderingContext::bufferForeground):

  • svg/graphics/SVGImage.cpp:

(WebCore::SVGImage::drawPatternForContainer):

Source/WebKit2:

ColorSpace parameters have been replaced with CGColorSpaceRef parameters for IOSurface.

  • Shared/mac/RemoteLayerBackingStore.mm:

(WebKit::RemoteLayerBackingStore::decode):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202863 r202867  
     12016-07-06  Antoine Quint  <graouts@apple.com>
     2
     3        <img> with a wide gamut PDF does not display using a wide gamut color space
     4        https://bugs.webkit.org/show_bug.cgi?id=158983
     5        <rdar://problem/25720247>
     6
     7        Reviewed by Tim Horton.
     8
     9        Calls to ImageBuffer::createCompatibleBuffer() that do not provide an explicit
     10        color space will now infer the color space from the provided graphics context
     11        on platforms using CG. The method signature that takes in a GraphicsContext
     12        without a color space is now split into a CG-specified implementation and a
     13        Cairo one to avoid having diverging platform code in ImageBuffer.cpp.
     14
     15        Some call sites need to provide an explicit color space still, so we add a new
     16        ImageBuffer::createCompatibleBuffer() that allows for that while inferring
     17        sizing and scaling from a GraphicsContext.
     18       
     19        All signatures of ImageBuffer::createCompatibleBuffer() are losing the
     20        hasAlpha parameter which was always ignored. All call sites that were using
     21        hasAlpha have been updated.
     22
     23        In addition, we make all the IOSurface and IOSurfacePool code, which is
     24        CG-specific, use the plaform-specific type CGColorSpaceRef instead of ColorSpace
     25        so that we may pick up on the color space copied over from the graphics context
     26        in the CG-specific implementation of ImageBuffer::createCompatibleBuffer().
     27
     28        * html/canvas/CanvasRenderingContext2D.cpp:
     29        (WebCore::CanvasRenderingContext2D::drawTextInternal):
     30        * platform/graphics/GradientImage.cpp:
     31        (WebCore::GradientImage::drawPattern):
     32        * platform/graphics/ImageBuffer.cpp:
     33        (WebCore::ImageBuffer::createCompatibleBuffer):
     34        * platform/graphics/ImageBuffer.h:
     35        * platform/graphics/NamedImageGeneratedImage.cpp:
     36        (WebCore::NamedImageGeneratedImage::drawPattern):
     37        * platform/graphics/cairo/ImageBufferCairo.cpp:
     38        (WebCore::ImageBuffer::createCompatibleBuffer):
     39        * platform/graphics/cg/IOSurfacePool.cpp:
     40        (WebCore::surfaceMatchesParameters):
     41        (WebCore::IOSurfacePool::takeSurface):
     42        * platform/graphics/cg/IOSurfacePool.h:
     43        * platform/graphics/cg/ImageBufferCG.cpp:
     44        (WebCore::ImageBuffer::createCompatibleBuffer):
     45        (WebCore::ImageBuffer::ImageBuffer):
     46        * platform/graphics/cocoa/IOSurface.h:
     47        * platform/graphics/cocoa/IOSurface.mm:
     48        (WebCore::IOSurface::surfaceFromPool):
     49        (WebCore::IOSurface::create):
     50        (WebCore::IOSurface::createFromSendRight):
     51        (WebCore::IOSurface::createFromSurface):
     52        (WebCore::IOSurface::createFromImage):
     53        (WebCore::IOSurface::IOSurface):
     54        (WebCore::IOSurface::ensurePlatformContext):
     55        * platform/mac/ThemeMac.mm:
     56        (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
     57        * platform/spi/cg/CoreGraphicsSPI.h:
     58        * rendering/RenderBoxModelObject.cpp:
     59        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     60        * rendering/RenderThemeMac.mm:
     61        (WebCore::RenderThemeMac::paintProgressBar):
     62        * rendering/svg/SVGRenderingContext.cpp:
     63        (WebCore::SVGRenderingContext::bufferForeground):
     64        * svg/graphics/SVGImage.cpp:
     65        (WebCore::SVGImage::drawPatternForContainer):
     66
    1672016-07-06  Tim Horton  <timothy_horton@apple.com>
    268
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r202712 r202867  
    24582458        }
    24592459
    2460         auto maskImage = ImageBuffer::createCompatibleBuffer(maskRect.size(), *c);
     2460        auto maskImage = ImageBuffer::createCompatibleBuffer(maskRect.size(), ColorSpaceSRGB, *c);
    24612461        if (!maskImage)
    24622462            return;
  • trunk/Source/WebCore/platform/graphics/GradientImage.cpp

    r201629 r202867  
    7676
    7777    if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !m_cachedImageBuffer->isCompatibleWithContext(destContext)) {
    78         m_cachedImageBuffer = ImageBuffer::createCompatibleBuffer(adjustedSize, destContext, m_gradient->hasAlpha());
     78        m_cachedImageBuffer = ImageBuffer::createCompatibleBuffer(adjustedSize, ColorSpaceSRGB, destContext);
    7979        if (!m_cachedImageBuffer)
    8080            return;
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp

    r202394 r202867  
    165165#endif
    166166
    167 std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, const GraphicsContext& context, bool hasAlpha)
     167std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, ColorSpace colorSpace, const GraphicsContext& context)
    168168{
    169169    if (size.isEmpty())
     
    172172    IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
    173173
    174     auto buffer = ImageBuffer::createCompatibleBuffer(scaledSize, 1, ColorSpaceSRGB, context, hasAlpha);
     174    auto buffer = ImageBuffer::createCompatibleBuffer(scaledSize, 1, colorSpace, context);
    175175    if (!buffer)
    176176        return nullptr;
     
    181181}
    182182
    183 std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const GraphicsContext& context, bool)
     183std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const GraphicsContext& context)
    184184{
    185185    return create(size, context.renderingMode(), resolutionScale, colorSpace);
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.h

    r202394 r202867  
    8181
    8282    // Create an image buffer compatible with the context, with suitable resolution for drawing into the buffer and then into this context.
    83     static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, const GraphicsContext&, bool hasAlpha = true);
    84     static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, float resolutionScale, ColorSpace, const GraphicsContext&, bool hasAlpha);
     83    static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, const GraphicsContext&);
     84    static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, ColorSpace, const GraphicsContext&);
     85    static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, float resolutionScale, ColorSpace, const GraphicsContext&);
    8586
    8687    static IntSize compatibleBufferSize(const FloatSize&, const GraphicsContext&);
     
    173174    // so that create() knows when it should return failure.
    174175    WEBCORE_EXPORT ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, bool& success);
     176#if USE(CG)
     177    ImageBuffer(const FloatSize&, float resolutionScale, CGColorSpaceRef, RenderingMode, bool& success);
     178#endif
    175179};
    176180
  • trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp

    r201629 r202867  
    6565{
    6666#if USE(NEW_THEME)
    67     auto imageBuffer = ImageBuffer::createCompatibleBuffer(size(), context, true);
     67    auto imageBuffer = ImageBuffer::createCompatibleBuffer(size(), context);
    6868    if (!imageBuffer)
    6969        return;
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r202484 r202867  
    233233}
    234234
     235std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, const GraphicsContext& context)
     236{
     237    return createCompatibleBuffer(size, ColorSpaceSRGB, context);
     238}
     239
    235240GraphicsContext& ImageBuffer::context() const
    236241{
  • trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp

    r201255 r202867  
    6565}
    6666
    67 static bool surfaceMatchesParameters(IOSurface& surface, IntSize requestedSize, ColorSpace colorSpace, IOSurface::Format format)
     67static bool surfaceMatchesParameters(IOSurface& surface, IntSize requestedSize, CGColorSpaceRef colorSpace, IOSurface::Format format)
    6868{
    6969    if (format != surface.format())
     
    108108}
    109109
    110 std::unique_ptr<IOSurface> IOSurfacePool::takeSurface(IntSize size, ColorSpace colorSpace, IOSurface::Format format)
     110std::unique_ptr<IOSurface> IOSurfacePool::takeSurface(IntSize size, CGColorSpaceRef colorSpace, IOSurface::Format format)
    111111{
    112112    CachedSurfaceMap::iterator mapIter = m_cachedSurfaces.find(size);
  • trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h

    r192709 r202867  
    2929#if USE(IOSURFACE)
    3030
    31 #include "ColorSpace.h"
    3231#include "IOSurface.h"
    3332#include "IntSize.h"
     
    4948    WEBCORE_EXPORT static IOSurfacePool& sharedPool();
    5049
    51     std::unique_ptr<IOSurface> takeSurface(IntSize, ColorSpace, IOSurface::Format);
     50    std::unique_ptr<IOSurface> takeSurface(IntSize, CGColorSpaceRef, IOSurface::Format);
    5251    WEBCORE_EXPORT void addSurface(std::unique_ptr<IOSurface>);
    5352
  • trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r202394 r202867  
    7171}
    7272
    73 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, bool& success)
     73std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, const GraphicsContext& context)
     74{
     75    if (size.isEmpty())
     76        return nullptr;
     77
     78    IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
     79    float resolutionScale = context.scaleFactor().width();
     80    RetainPtr<CGColorSpaceRef> colorSpace;
     81#if PLATFORM(COCOA)
     82    colorSpace = adoptCF(CGContextCopyDeviceColorSpace(context.platformContext()));
     83#else
     84    colorSpace = sRGBColorSpaceRef();
     85#endif
     86    RenderingMode renderingMode = context.renderingMode();
     87    bool success = false;
     88    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, resolutionScale, colorSpace.get(), renderingMode, success));
     89
     90    if (!success)
     91        return nullptr;
     92
     93    // Set up a corresponding scale factor on the graphics context.
     94    buffer->context().scale(FloatSize(scaledSize.width() / size.width(), scaledSize.height() / size.height()));
     95    return buffer;
     96}
     97
     98ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, CGColorSpaceRef colorSpace, RenderingMode renderingMode, bool& success)
    7499    : m_logicalSize(size)
    75100    , m_resolutionScale(resolutionScale)
     
    109134#endif
    110135
    111     m_data.colorSpace = cachedCGColorSpace(imageColorSpace);
     136    m_data.colorSpace = colorSpace;
    112137
    113138    RetainPtr<CGContextRef> cgContext;
     
    115140#if USE(IOSURFACE_CANVAS_BACKING_STORE)
    116141        FloatSize userBounds = sizeForDestinationSize(FloatSize(width.unsafeGet(), height.unsafeGet()));
    117         m_data.surface = IOSurface::create(m_data.backingStoreSize, IntSize(userBounds), imageColorSpace);
     142        m_data.surface = IOSurface::create(m_data.backingStoreSize, IntSize(userBounds), colorSpace);
    118143        cgContext = m_data.surface->ensurePlatformContext();
    119144        if (cgContext)
     
    150175
    151176    success = true;
     177}
     178
     179ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, bool& success)
     180    : ImageBuffer(size, resolutionScale, cachedCGColorSpace(imageColorSpace), renderingMode, success)
     181{
    152182}
    153183
  • trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h

    r202394 r202867  
    4646    };
    4747
    48     WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, ColorSpace, Format = Format::RGBA);
    49     WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, IntSize contextSize, ColorSpace, Format = Format::RGBA);
    50     WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromSendRight(const MachSendRight&, ColorSpace);
    51     static std::unique_ptr<IOSurface> createFromSurface(IOSurfaceRef, ColorSpace);
     48    WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, CGColorSpaceRef, Format = Format::RGBA);
     49    WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, IntSize contextSize, CGColorSpaceRef, Format = Format::RGBA);
     50    WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromSendRight(const MachSendRight&, CGColorSpaceRef);
     51    static std::unique_ptr<IOSurface> createFromSurface(IOSurfaceRef, CGColorSpaceRef);
    5252    WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromImage(CGImageRef);
    5353   
     
    8686    IntSize size() const { return m_size; }
    8787    size_t totalBytes() const { return m_totalBytes; }
    88     ColorSpace colorSpace() const { return m_colorSpace; }
     88    CGColorSpaceRef colorSpace() const { return m_colorSpace.get(); }
    8989    WEBCORE_EXPORT Format format() const;
    9090
     
    101101
    102102private:
    103     IOSurface(IntSize, ColorSpace, Format);
    104     IOSurface(IntSize, IntSize contextSize, ColorSpace, Format);
    105     IOSurface(IOSurfaceRef, ColorSpace);
     103    IOSurface(IntSize, CGColorSpaceRef, Format);
     104    IOSurface(IntSize, IntSize contextSize, CGColorSpaceRef, Format);
     105    IOSurface(IOSurfaceRef, CGColorSpaceRef);
    106106
    107     static std::unique_ptr<IOSurface> surfaceFromPool(IntSize, IntSize contextSize, ColorSpace, Format);
     107    static std::unique_ptr<IOSurface> surfaceFromPool(IntSize, IntSize contextSize, CGColorSpaceRef, Format);
    108108    IntSize contextSize() const { return m_contextSize; }
    109109    void setContextSize(IntSize);
    110110
    111     ColorSpace m_colorSpace;
     111    RetainPtr<CGColorSpaceRef> m_colorSpace;
    112112    IntSize m_size;
    113113    IntSize m_contextSize;
  • trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm

    r202142 r202867  
    4646using namespace WebCore;
    4747
    48 inline std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
     48inline std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, CGColorSpaceRef colorSpace, Format pixelFormat)
    4949{
    5050    auto cachedSurface = IOSurfacePool::sharedPool().takeSurface(size, colorSpace, pixelFormat);
     
    5656}
    5757
    58 std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
     58std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, CGColorSpaceRef colorSpace, Format pixelFormat)
    5959{
    6060    if (auto cachedSurface = surfaceFromPool(size, size, colorSpace, pixelFormat))
     
    6464}
    6565
    66 std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
     66std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, IntSize contextSize, CGColorSpaceRef colorSpace, Format pixelFormat)
    6767{
    6868    if (auto cachedSurface = surfaceFromPool(size, contextSize, colorSpace, pixelFormat))
     
    7171}
    7272
    73 std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSendRight(const MachSendRight& sendRight, ColorSpace colorSpace)
     73std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSendRight(const MachSendRight& sendRight, CGColorSpaceRef colorSpace)
    7474{
    7575    auto surface = adoptCF(IOSurfaceLookupFromMachPort(sendRight.sendRight()));
     
    7777}
    7878
    79 std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSurface(IOSurfaceRef surface, ColorSpace colorSpace)
     79std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSurface(IOSurfaceRef surface, CGColorSpaceRef colorSpace)
    8080{
    8181    return std::unique_ptr<IOSurface>(new IOSurface(surface, colorSpace));
     
    9090    size_t height = CGImageGetHeight(image);
    9191
    92     auto surface = IOSurface::create(IntSize(width, height), ColorSpaceSRGB);
     92    auto surface = IOSurface::create(IntSize(width, height), sRGBColorSpaceRef());
    9393    auto surfaceContext = surface->ensurePlatformContext();
    9494    CGContextDrawImage(surfaceContext, CGRectMake(0, 0, width, height), image);
     
    180180}
    181181
    182 WebCore::IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
     182WebCore::IOSurface::IOSurface(IntSize size, CGColorSpaceRef colorSpace, Format format)
    183183    : m_colorSpace(colorSpace)
    184184    , m_size(size)
     
    208208}
    209209
    210 WebCore::IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
     210WebCore::IOSurface::IOSurface(IntSize size, IntSize contextSize, CGColorSpaceRef colorSpace, Format pixelFormat)
    211211    : IOSurface(size, colorSpace, pixelFormat)
    212212{
     
    216216}
    217217
    218 WebCore::IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
     218WebCore::IOSurface::IOSurface(IOSurfaceRef surface, CGColorSpaceRef colorSpace)
    219219    : m_colorSpace(colorSpace)
    220220    , m_surface(surface)
     
    298298    }
    299299   
    300     m_cgContext = adoptCF(CGIOSurfaceContextCreate(m_surface.get(), m_contextSize.width(), m_contextSize.height(), bitsPerComponent, bitsPerPixel, cachedCGColorSpace(m_colorSpace), bitmapInfo));
     300    m_cgContext = adoptCF(CGIOSurfaceContextCreate(m_surface.get(), m_contextSize.width(), m_contextSize.height(), bitsPerComponent, bitsPerPixel, m_colorSpace.get(), bitmapInfo));
    301301
    302302    return m_cgContext.get();
  • trunk/Source/WebCore/platform/mac/ThemeMac.mm

    r201038 r202867  
    680680    if (useImageBuffer) {
    681681        NSRect imageBufferDrawRect = NSRect(FloatRect(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth, rect.width(), rect.height()));
    682         auto imageBuffer = ImageBuffer::createCompatibleBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor, ColorSpaceSRGB, context, false);
     682        auto imageBuffer = ImageBuffer::createCompatibleBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor, ColorSpaceSRGB, context);
    683683        if (!imageBuffer)
    684684            return needsRepaint;
  • trunk/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h

    r201572 r202867  
    189189CGRect* CGSNextRect(const CGSRegionEnumeratorObj);
    190190CGError CGSReleaseRegionEnumerator(const CGSRegionEnumeratorObj);
     191CGColorSpaceRef CGContextCopyDeviceColorSpace(CGContextRef);
    191192#endif
    192193
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r201868 r202867  
    757757
    758758        // Now create the mask.
    759         maskImage = ImageBuffer::createCompatibleBuffer(maskRect.size(), context);
     759        maskImage = ImageBuffer::createCompatibleBuffer(maskRect.size(), ColorSpaceSRGB, context);
    760760        if (!maskImage)
    761761            return;
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r202274 r202867  
    11451145    trackInfo.filler1 = 0;
    11461146
    1147     std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::createCompatibleBuffer(inflatedRect.size(), deviceScaleFactor, ColorSpaceSRGB, paintInfo.context(), true);
     1147    std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::createCompatibleBuffer(inflatedRect.size(), deviceScaleFactor, ColorSpaceSRGB, paintInfo.context());
    11481148    if (!imageBuffer)
    11491149        return true;
  • trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp

    r201629 r202867  
    352352    // Create a new buffer and paint the foreground into it.
    353353    if (!imageBuffer) {
    354         if ((imageBuffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(boundingBox.size()), m_paintInfo->context(), true))) {
     354        if ((imageBuffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(boundingBox.size()), ColorSpaceSRGB, m_paintInfo->context()))) {
    355355            GraphicsContext& bufferedRenderingContext = imageBuffer->context();
    356356            bufferedRenderingContext.translate(-boundingBox.x(), -boundingBox.y());
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r202005 r202867  
    220220    imageBufferSize.scale(imageBufferScale.width(), imageBufferScale.height());
    221221
    222     std::unique_ptr<ImageBuffer> buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceSRGB, context, true);
     222    std::unique_ptr<ImageBuffer> buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceSRGB, context);
    223223    if (!buffer) // Failed to allocate buffer.
    224224        return;
  • trunk/Source/WebKit2/ChangeLog

    r202858 r202867  
     12016-07-06  Antoine Quint  <graouts@apple.com>
     2
     3        <img> with a wide gamut PDF does not display using a wide gamut color space
     4        https://bugs.webkit.org/show_bug.cgi?id=158983
     5        <rdar://problem/25720247>
     6
     7        Reviewed by Tim Horton.
     8
     9        ColorSpace parameters have been replaced with CGColorSpaceRef parameters for IOSurface.
     10
     11        * Shared/mac/RemoteLayerBackingStore.mm:
     12        (WebKit::RemoteLayerBackingStore::decode):
     13        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
     14        * UIProcess/API/Cocoa/WKWebView.mm:
     15        (-[WKWebView _takeViewSnapshot]):
     16        (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
     17
    1182016-07-06  Commit Queue  <commit-queue@webkit.org>
    219
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm

    r202229 r202867  
    151151        if (!decoder.decode(sendRight))
    152152            return false;
    153         result.m_frontBuffer.surface = WebCore::IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
     153        result.m_frontBuffer.surface = WebCore::IOSurface::createFromSendRight(sendRight, sRGBColorSpaceRef());
    154154        return true;
    155155    }
     
    211211
    212212        if (!m_frontBuffer.surface)
    213             m_frontBuffer.surface = WebCore::IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
     213            m_frontBuffer.surface = WebCore::IOSurface::create(expandedScaledSize, sRGBColorSpaceRef(), bufferFormat(m_isOpaque));
    214214
    215215        setBufferVolatility(BufferType::Front, false);
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r202695 r202867  
    8383#import "_WKSessionStateInternal.h"
    8484#import "_WKVisitedLinkStoreInternal.h"
     85#import <WebCore/GraphicsContextCG.h>
    8586#import <WebCore/IOSurface.h>
    8687#import <WebCore/JSDOMBinding.h>
     
    13921393#if USE(IOSURFACE)
    13931394    WebCore::IOSurface::Format snapshotFormat = WebCore::screenSupportsExtendedColor() ? WebCore::IOSurface::Format::RGB10 : WebCore::IOSurface::Format::RGBA;
    1394     auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceSRGB, snapshotFormat);
     1395    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::sRGBColorSpaceRef(), snapshotFormat);
    13951396    CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
    13961397
     
    42294230    // If we are parented and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly.
    42304231    if (CADisplay *display = self.window.screen._display) {
    4231         auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::ColorSpaceSRGB);
     4232        auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::sRGBColorSpaceRef());
    42324233        CGFloat imageScaleInViewCoordinates = imageWidth / rectInViewCoordinates.size.width;
    42334234        CATransform3D transform = CATransform3DMakeScale(imageScaleInViewCoordinates, imageScaleInViewCoordinates, 1);
Note: See TracChangeset for help on using the changeset viewer.