<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 <graouts@apple.com> 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:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@202867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed