| Differences between
and this patch
- a/Source/WTF/ChangeLog +10 lines
Lines 1-3 a/Source/WTF/ChangeLog_sec1
1
2021-10-03  Cameron McCormack  <heycam@apple.com>
2
3
        Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space
4
        https://bugs.webkit.org/show_bug.cgi?id=229025
5
        <rdar://problem/81828490>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * wtf/PlatformHave.h: Add HAVE_CVBUFFERCOPYATTACHMENTS.
10
1
2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
11
2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
2
12
3
        Upgrade in-tree OSS ICU header to 64.2 because macOS Mojave build will be dropped
13
        Upgrade in-tree OSS ICU header to 64.2 because macOS Mojave build will be dropped
- a/Source/WebCore/ChangeLog +150 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2021-09-21  Cameron McCormack  <heycam@apple.com>
2
3
        Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space
4
        https://bugs.webkit.org/show_bug.cgi?id=229025
5
        <rdar://problem/81828490>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        When GPU process media handling is disabled (and in the GPU process
10
        when it is handling a NativeImageForCurrentTime message),
11
        MediaPlayer::nativeImageForCurrentTime is used to get the video frame
12
        image. We make this return an image with the right color space on
13
        Apple platforms in PixelBufferConformerCV::createImageFromPixelBuffer.
14
15
        For now, we avoid using the correct color space when passing
16
        HTMLVideoElements to WebGLRenderingContext.texImage2D. The
17
        specification is unclear about what color space the texture data
18
        should be in, and implementations are currently interoperable in not
19
        converting the RGB color space of the video (such as Rec.601, Rec.709,
20
        etc.) into sRGB. To avoid the conversion, and effectively reinterpret
21
        the video RGB colors as sRGB, we make the ImageBuffer the video is
22
        drawn into have a matching color space, as it's the raw RGB values
23
        from the ImageBuffer that are uploade as the texture.
24
25
        (An alternative to this could be passing an argument through
26
        nativeImageForCurrentTime and paintCurrentFrameInContext, which says
27
        to avoid doing the conversion from video RGB to sRGB, but that needs a
28
        fair amount of plumbing.)
29
30
        If https://github.com/KhronosGroup/WebGL/issues/2165 is resolved, the
31
        changes to LRUImageBufferCache in this commit can be reverted, so that
32
        video frames are drawn into sRGB ImageBuffers again. (We'd also need
33
        something to make the copyToPlatformTexture() call in
34
        texImageSourceHelper do the correct color conversion somehow.)
35
36
        The now differing behavior between CanvasRenderingContext2D.drawImage
37
        and WebGLRenderingContext.texImage2D means that the WebGL conformance
38
        suite textures/misc/texture-corner-case-videos.html test fails, since
39
        it checks for incorrect 2D canvas video frame color conversion.
40
41
        Tests: imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html
42
               imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html
43
44
        * html/HTMLVideoElement.cpp:
45
        (WebCore::HTMLVideoElement::colorSpace const): New function that
46
        exposes the color space of the current frame of the video.
47
        * html/HTMLVideoElement.h:
48
        * html/ImageBitmap.cpp:
49
        (WebCore::ImageBitmap::createPromise): Create the ImageBuffer in a
50
        color space that matches the video, not always sRGB.
51
        * html/canvas/WebGLRenderingContextBase.cpp:
52
        (WebCore::WebGLRenderingContextBase::drawImageIntoBuffer):
53
        (WebCore::WebGLRenderingContextBase::videoFrameToImage): Use an
54
        ImageBuffer whose color space matches the video frame's color space.
55
        (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
56
        Add a DestinationColorSpace argument, so that the LRU cache is keyed
57
        off both size and color space.
58
        * html/canvas/WebGLRenderingContextBase.h:
59
        * platform/cocoa/CoreVideoSoftLink.cpp:
60
        * platform/cocoa/CoreVideoSoftLink.h: Add SPIs that let us get or
61
        compute a CGColorSpace from a CVPixelBuffer. Remove
62
        CVImageBufferGetColorSpace, which is unsused.
63
        * platform/graphics/MediaPlayer.cpp:
64
        (WebCore::MediaPlayer::colorSpace):
65
        * platform/graphics/MediaPlayer.h:
66
        * platform/graphics/MediaPlayerPrivate.h:
67
        (WebCore::MediaPlayerPrivateInterface::colorSpace):
68
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
69
        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
70
        (WebCore::MediaPlayerPrivateAVFoundationObjC::colorSpace): Expose the
71
        color space of the current image. While we strictly only need the pixel
72
        buffer to be up to date, we call updateLastImage() since it has the
73
        UpdateSynchronously behavior, and the caller to colorSpace() will use
74
        the image soon anyway.
75
        * platform/graphics/cg/ColorSpaceCG.h:
76
        * platform/graphics/cv/CVUtilities.h:
77
        * platform/graphics/cv/CVUtilities.mm:
78
        (WebCore::createCGColorSpaceForCVPixelBuffer): New function to produce
79
        a CGColorSpace for a CVPixelBuffer. On macOS, this is stored as an
80
        attachment on the CVPixelBuffer. On iOS, we must call SPI to create a
81
        CGColorSpace based on the other color space information in the
82
        attachments. (It's possible we should cache the results of this
83
        function for a given set of color space attachments, since
84
        CVImageBufferCreateColorSpaceFromAttachments can end up creating a new
85
        CGColorSpace object every time it's called.)
86
        * platform/graphics/cv/PixelBufferConformerCV.cpp:
87
        (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer): Create
88
        the CGImage in a color space matching the CVPixelBuffer.
89
90
2021-09-30  Cameron McCormack  <heycam@apple.com>
91
92
        Choose an appropriate color space when converting an SVG image into a NativeImage for canvas drawImage
93
        https://bugs.webkit.org/show_bug.cgi?id=231062
94
        <rdar://problem/83752451>
95
96
        Reviewed by NOBODY (OOPS!).
97
98
        When GPUP canvas is enabled, drawImage() with an SVG image is handled
99
        by drawing into a NativeImage and then sending that to the GPUP. We
100
        need to choose a color space for the NativeImage's ImageBuffer that
101
        matches the canvas.
102
103
        Once full SVG rendering is supported by the GPU process, we can undo
104
        this code, as we'll no longer be using a NativeImage.
105
106
        Test: imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html
107
108
        * html/CustomPaintImage.cpp:
109
        (WebCore::CustomPaintImage::draw):
110
        * html/CustomPaintImage.h:
111
        * html/canvas/CanvasRenderingContext2DBase.cpp:
112
        (WebCore::CanvasRenderingContext2DBase::drawImage):
113
        (WebCore::drawImageToContext):
114
        (WebCore::CanvasRenderingContext2DBase::fullCanvasCompositedDrawImage):
115
        * platform/graphics/BitmapImage.cpp:
116
        (WebCore::BitmapImage::draw):
117
        * platform/graphics/BitmapImage.h:
118
        * platform/graphics/CrossfadeGeneratedImage.cpp:
119
        (WebCore::CrossfadeGeneratedImage::draw):
120
        * platform/graphics/CrossfadeGeneratedImage.h:
121
        * platform/graphics/GeneratedImage.h:
122
        (WebCore::GeneratedImage::draw):
123
        * platform/graphics/GradientImage.cpp:
124
        (WebCore::GradientImage::draw):
125
        * platform/graphics/GradientImage.h:
126
        * platform/graphics/GraphicsContext.cpp:
127
        (WebCore::GraphicsContext::drawImage):
128
        * platform/graphics/GraphicsContext.h:
129
        (WebCore::GraphicsContext::drawImage):
130
        * platform/graphics/Image.h:
131
        (WebCore::Image::draw):
132
        * platform/graphics/MediaPlayer.h:
133
        * platform/graphics/NamedImageGeneratedImage.cpp:
134
        (WebCore::NamedImageGeneratedImage::draw):
135
        * platform/graphics/NamedImageGeneratedImage.h:
136
        * platform/graphics/NullGraphicsContext.h:
137
        (WebCore::NullGraphicsContext::drawImage):
138
        * platform/graphics/cg/PDFDocumentImage.cpp:
139
        (WebCore::PDFDocumentImage::draw):
140
        * platform/graphics/cg/PDFDocumentImage.h:
141
        * svg/graphics/SVGImage.cpp:
142
        (WebCore::SVGImage::drawForContainer):
143
        (WebCore::SVGImage::nativeImage):
144
        (WebCore::SVGImage::draw):
145
        (WebCore::SVGImage::drawAsNativeImage):
146
        * svg/graphics/SVGImage.h:
147
        * svg/graphics/SVGImageForContainer.cpp:
148
        (WebCore::SVGImageForContainer::draw):
149
        * svg/graphics/SVGImageForContainer.h:
150
1
2021-10-01  Nikos Mouchtaris  <nmouchtaris@apple.com>
151
2021-10-01  Nikos Mouchtaris  <nmouchtaris@apple.com>
2
152
3
        Allow NaN, infinity, and -infinity in calc
153
        Allow NaN, infinity, and -infinity in calc
- a/Source/WebKit/ChangeLog +41 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2021-09-21  Cameron McCormack  <heycam@apple.com>
2
3
        Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space
4
        https://bugs.webkit.org/show_bug.cgi?id=229025
5
        <rdar://problem/81828490>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        When GPU process media handling is enabled, ctx.drawImage(video)
10
        calls work by sending a NativeImageForCurrentTime message to the GPU
11
        process, which returns an IOSurface around which a CGImage is created.
12
        There's no good way to get the color space off the IOSurface, so we
13
        add a second return argument to NativeImageForCurrentTime to indicate
14
        the color space used.
15
16
        ImageBitmap creates an ImageBuffer for that image to be painted into,
17
        and for that we also need to know the color space of the video. The
18
        code that sends NativeImageForCurrentTime and then paints the
19
        resulting image into the GraphicsContext is further down. So we add
20
        a separate IPC message that gets the color space of the video's
21
        current frame. (It would be better if we could avoid a second
22
        synchronous IPC message call, but either ImageBitmap's scaling and
23
        cropping code, or the ImageBuffer creation call, would need to be moved
24
        down into MediaPlayerPrivateRemote::paintCurrentFrameInContext, which
25
        doesn't seem like the right place for it.)
26
27
        * GPUProcess/media/RemoteMediaPlayerProxy.h:
28
        * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
29
        * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
30
        (WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime):
31
        (WebKit::RemoteMediaPlayerProxy::colorSpace):
32
        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
33
        (WebKit::MediaPlayerPrivateRemote::colorSpace):
34
        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
35
        * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
36
        (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): Add a
37
        second return argument to NativeImageForCurrentTime to indicate the
38
        color space of the returned IOSurface.
39
        (WebKit::MediaPlayerPrivateRemote::colorSpace): Add a new IPC message to
40
        get the color space of a video's current frame.
41
1
2021-10-01  Chris Dumez  <cdumez@apple.com>
42
2021-10-01  Chris Dumez  <cdumez@apple.com>
2
43
3
        Drop support for macOS < 10.15
44
        Drop support for macOS < 10.15
- a/Source/WTF/wtf/PlatformHave.h +7 lines
Lines 1061-1063 a/Source/WTF/wtf/PlatformHave.h_sec1
1061
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
1061
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
1062
#define HAVE_AVSAMPLEBUFFERVIDEOOUTPUT 1
1062
#define HAVE_AVSAMPLEBUFFERVIDEOOUTPUT 1
1063
#endif
1063
#endif
1064
1065
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \
1066
    || (((PLATFORM(IOS) && !PLATFORM(IOS_FAMILY_SIMULATOR)) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
1067
    || (PLATFORM(WATCHOS) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \
1068
    || (PLATFORM(APPLETV) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __TV_OS_VERSION_MIN_REQUIRED >= 150000)
1069
#define HAVE_CVBUFFERCOPYATTACHMENTS 1
1070
#endif
- a/Source/WebCore/html/CustomPaintImage.cpp -1 / +1 lines
Lines 172-178 ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co a/Source/WebCore/html/CustomPaintImage.cpp_sec1
172
    return ImageDrawResult::DidDraw;
172
    return ImageDrawResult::DidDraw;
173
}
173
}
174
174
175
ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
175
ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
176
{
176
{
177
    GraphicsContextStateSaver stateSaver(destContext);
177
    GraphicsContextStateSaver stateSaver(destContext);
178
    destContext.setCompositeOperation(options.compositeOperator(), options.blendMode());
178
    destContext.setCompositeOperation(options.compositeOperator(), options.blendMode());
- a/Source/WebCore/html/CustomPaintImage.h -1 / +1 lines
Lines 52-58 private: a/Source/WebCore/html/CustomPaintImage.h_sec1
52
52
53
    ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&);
53
    ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&);
54
54
55
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
55
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) final;
56
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
56
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
57
57
58
    WeakPtr<PaintWorkletGlobalScope::PaintDefinition> m_paintDefinition;
58
    WeakPtr<PaintWorkletGlobalScope::PaintDefinition> m_paintDefinition;
- a/Source/WebCore/html/HTMLVideoElement.cpp +9 lines
Lines 283-288 void HTMLVideoElement::mediaPlayerFirstVideoFrameAvailable() a/Source/WebCore/html/HTMLVideoElement.cpp_sec1
283
        renderer->updateFromElement();
283
        renderer->updateFromElement();
284
}
284
}
285
285
286
std::optional<DestinationColorSpace> HTMLVideoElement::colorSpace() const
287
{
288
    RefPtr<MediaPlayer> player = HTMLMediaElement::player();
289
    if (!player)
290
        return std::nullopt;
291
292
    return player->colorSpace();
293
}
294
286
RefPtr<ImageBuffer> HTMLVideoElement::createBufferForPainting(const FloatSize& size, RenderingMode renderingMode, const DestinationColorSpace& colorSpace, PixelFormat pixelFormat) const
295
RefPtr<ImageBuffer> HTMLVideoElement::createBufferForPainting(const FloatSize& size, RenderingMode renderingMode, const DestinationColorSpace& colorSpace, PixelFormat pixelFormat) const
287
{
296
{
288
    auto* hostWindow = document().view() && document().view()->root() ? document().view()->root()->hostWindow() : nullptr;
297
    auto* hostWindow = document().view() && document().view()->root() ? document().view()->root()->hostWindow() : nullptr;
- a/Source/WebCore/html/HTMLVideoElement.h +1 lines
Lines 78-83 public: a/Source/WebCore/html/HTMLVideoElement.h_sec1
78
    void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&);
78
    void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&);
79
79
80
    WEBCORE_EXPORT RefPtr<NativeImage> nativeImageForCurrentTime();
80
    WEBCORE_EXPORT RefPtr<NativeImage> nativeImageForCurrentTime();
81
    std::optional<DestinationColorSpace> colorSpace() const;
81
82
82
    WEBCORE_EXPORT bool shouldDisplayPosterImage() const;
83
    WEBCORE_EXPORT bool shouldDisplayPosterImage() const;
83
84
- a/Source/WebCore/html/ImageBitmap.cpp -2 / +6 lines
Lines 512-519 void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, a/Source/WebCore/html/ImageBitmap.cpp_sec1
512
512
513
    auto outputSize = outputSizeForSourceRectangle(sourceRectangle, options);
513
    auto outputSize = outputSizeForSourceRectangle(sourceRectangle, options);
514
514
515
    // FIXME: Add support for color spaces / pixel formats to ImageBitmap.
515
    auto colorSpace = video->colorSpace();
516
    auto bitmapData = video->createBufferForPainting(outputSize, bufferRenderingMode, DestinationColorSpace::SRGB(), PixelFormat::BGRA8);
516
    if (!colorSpace)
517
        colorSpace = DestinationColorSpace::SRGB();
518
519
    // FIXME: Add support for pixel formats to ImageBitmap.
520
    auto bitmapData = video->createBufferForPainting(outputSize, bufferRenderingMode, *colorSpace, PixelFormat::BGRA8);
517
    if (!bitmapData) {
521
    if (!bitmapData) {
518
        resolveWithBlankImageBuffer(scriptExecutionContext, !taintsOrigin(scriptExecutionContext.securityOrigin(), *video), WTFMove(promise));
522
        resolveWithBlankImageBuffer(scriptExecutionContext, !taintsOrigin(scriptExecutionContext.securityOrigin(), *video), WTFMove(promise));
519
        return;
523
        return;
- a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp -7 / +7 lines
Lines 1570-1586 ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(Document& document, Ca a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp_sec1
1570
1570
1571
    bool repaintEntireCanvas = false;
1571
    bool repaintEntireCanvas = false;
1572
    if (rectContainsCanvas(normalizedDstRect)) {
1572
    if (rectContainsCanvas(normalizedDstRect)) {
1573
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options);
1573
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options, colorSpace());
1574
        repaintEntireCanvas = true;
1574
        repaintEntireCanvas = true;
1575
    } else if (isFullCanvasCompositeMode(op)) {
1575
    } else if (isFullCanvasCompositeMode(op)) {
1576
        fullCanvasCompositedDrawImage(*image, normalizedDstRect, normalizedSrcRect, op);
1576
        fullCanvasCompositedDrawImage(*image, normalizedDstRect, normalizedSrcRect, op);
1577
        repaintEntireCanvas = true;
1577
        repaintEntireCanvas = true;
1578
    } else if (op == CompositeOperator::Copy) {
1578
    } else if (op == CompositeOperator::Copy) {
1579
        clearCanvas();
1579
        clearCanvas();
1580
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options);
1580
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options, colorSpace());
1581
        repaintEntireCanvas = true;
1581
        repaintEntireCanvas = true;
1582
    } else
1582
    } else
1583
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options);
1583
        c->drawImage(*image, normalizedDstRect, normalizedSrcRect, options, colorSpace());
1584
1584
1585
    if (isEntireBackingStoreDirty())
1585
    if (isEntireBackingStoreDirty())
1586
        didDraw(std::nullopt);
1586
        didDraw(std::nullopt);
Lines 1842-1853 void CanvasRenderingContext2DBase::compositeBuffer(ImageBuffer& buffer, const In a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp_sec2
1842
    c->restore();
1842
    c->restore();
1843
}
1843
}
1844
1844
1845
static void drawImageToContext(Image& image, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options)
1845
static void drawImageToContext(Image& image, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options, DestinationColorSpace colorSpace)
1846
{
1846
{
1847
    context.drawImage(image, dest, src, options);
1847
    context.drawImage(image, dest, src, options, colorSpace);
1848
}
1848
}
1849
1849
1850
static void drawImageToContext(ImageBuffer& imageBuffer, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options)
1850
static void drawImageToContext(ImageBuffer& imageBuffer, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options, DestinationColorSpace)
1851
{
1851
{
1852
    context.drawImageBuffer(imageBuffer, dest, src, options);
1852
    context.drawImageBuffer(imageBuffer, dest, src, options);
1853
}
1853
}
Lines 1878-1884 template<class T> void CanvasRenderingContext2DBase::fullCanvasCompositedDrawIma a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp_sec3
1878
    buffer->context().translate(-transformedAdjustedRect.location());
1878
    buffer->context().translate(-transformedAdjustedRect.location());
1879
    buffer->context().translate(croppedOffset);
1879
    buffer->context().translate(croppedOffset);
1880
    buffer->context().concatCTM(effectiveTransform);
1880
    buffer->context().concatCTM(effectiveTransform);
1881
    drawImageToContext(image, buffer->context(), adjustedDest, src, { CompositeOperator::SourceOver });
1881
    drawImageToContext(image, buffer->context(), adjustedDest, src, { CompositeOperator::SourceOver }, colorSpace());
1882
1882
1883
    compositeBuffer(*buffer, bufferRect, op);
1883
    compositeBuffer(*buffer, bufferRect, op);
1884
}
1884
}
- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp -13 / +26 lines
Lines 5885-5891 RefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image& image, int w a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp_sec1
5885
{
5885
{
5886
    IntSize size(width, height);
5886
    IntSize size(width, height);
5887
    size.scale(deviceScaleFactor);
5887
    size.scale(deviceScaleFactor);
5888
    ImageBuffer* buf = m_generatedImageCache.imageBuffer(size);
5888
    ImageBuffer* buf = m_generatedImageCache.imageBuffer(size, DestinationColorSpace::SRGB());
5889
    if (!buf) {
5889
    if (!buf) {
5890
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5890
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5891
        return nullptr;
5891
        return nullptr;
Lines 5901-5906 RefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image& image, int w a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp_sec2
5901
5901
5902
RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, const char* functionName)
5902
RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, const char* functionName)
5903
{
5903
{
5904
    // FIXME: When texImage2D is passed an HTMLVideoElement, implementations
5905
    // interoperably use the native RGB color values of the video frame (e.g.
5906
    // Rec.601 color space values) for the texture. But nativeImageForCurrentTime
5907
    // and paintCurrentFrameInContext return and use an image with its color space
5908
    // correctly matching the video.
5909
    //
5910
    // https://github.com/KhronosGroup/WebGL/issues/2165 is open on converting
5911
    // the video element image source to sRGB instead of leaving it in its
5912
    // native RGB color space. For now, we make sure to paint into an
5913
    // ImageBuffer with a matching color space, to avoid the conversion.
5904
#if USE(AVFOUNDATION)
5914
#if USE(AVFOUNDATION)
5905
    auto nativeImage = video->nativeImageForCurrentTime();
5915
    auto nativeImage = video->nativeImageForCurrentTime();
5906
    // Currently we might be missing an image due to MSE not being able to provide the first requested frame.
5916
    // Currently we might be missing an image due to MSE not being able to provide the first requested frame.
Lines 5913-5919 RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* vid a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp_sec3
5913
        return nullptr;
5923
        return nullptr;
5914
    }
5924
    }
5915
    FloatRect imageRect { { }, imageSize };
5925
    FloatRect imageRect { { }, imageSize };
5916
    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(imageSize, CompositeOperator::Copy);
5926
    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(imageSize, nativeImage->colorSpace(), CompositeOperator::Copy);
5917
    if (!imageBuffer) {
5927
    if (!imageBuffer) {
5918
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5928
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5919
        return nullptr;
5929
        return nullptr;
Lines 5924-5930 RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* vid a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp_sec4
5924
    // video visible size is different to the natural size. This should be removed
5934
    // video visible size is different to the natural size. This should be removed
5925
    // once all platforms implement nativeImageForCurrentTime().
5935
    // once all platforms implement nativeImageForCurrentTime().
5926
    IntSize videoSize { static_cast<int>(video->videoWidth()), static_cast<int>(video->videoHeight()) };
5936
    IntSize videoSize { static_cast<int>(video->videoWidth()), static_cast<int>(video->videoHeight()) };
5927
    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(videoSize);
5937
    auto colorSpace = video->colorSpace();
5938
    if (!colorSpace)
5939
        colorSpace = DestinationColorSpace::SRGB();
5940
    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(videoSize, *colorSpace);
5928
    if (!imageBuffer) {
5941
    if (!imageBuffer) {
5929
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5942
        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
5930
        return nullptr;
5943
        return nullptr;
Lines 7778-7809 WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache(int capacity a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp_sec5
7778
{
7791
{
7779
}
7792
}
7780
7793
7781
ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size, CompositeOperator fillOperator)
7794
ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size, DestinationColorSpace colorSpace, CompositeOperator fillOperator)
7782
{
7795
{
7783
    size_t i;
7796
    size_t i;
7784
    for (i = 0; i < m_buffers.size(); ++i) {
7797
    for (i = 0; i < m_buffers.size(); ++i) {
7785
        ImageBuffer* buf = m_buffers[i].get();
7798
        if (!m_buffers[i])
7786
        if (!buf)
7787
            break;
7799
            break;
7788
        if (buf->logicalSize() != size)
7800
        ImageBuffer& buf = m_buffers[i]->second.get();
7801
        if (m_buffers[i]->first != colorSpace || buf.logicalSize() != size)
7789
            continue;
7802
            continue;
7790
        bubbleToFront(i);
7803
        bubbleToFront(i);
7791
        if (fillOperator != CompositeOperator::Copy && fillOperator != CompositeOperator::Clear)
7804
        if (fillOperator != CompositeOperator::Copy && fillOperator != CompositeOperator::Clear)
7792
            buf->context().clearRect({ { }, size });
7805
            buf.context().clearRect({ { }, size });
7793
        return buf;
7806
        return &buf;
7794
    }
7807
    }
7795
7808
7796
    // FIXME (149423): Should this ImageBuffer be unconditionally unaccelerated?
7809
    // FIXME (149423): Should this ImageBuffer be unconditionally unaccelerated?
7797
    auto temp = ImageBuffer::create(size, RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8);
7810
    auto temp = ImageBuffer::create(size, RenderingMode::Unaccelerated, 1, colorSpace, PixelFormat::BGRA8);
7798
    if (!temp)
7811
    if (!temp)
7799
        return nullptr;
7812
        return nullptr;
7800
    ASSERT(m_buffers.size() > 0);
7813
    ASSERT(m_buffers.size() > 0);
7801
    i = std::min(m_buffers.size() - 1, i);
7814
    i = std::min(m_buffers.size() - 1, i);
7802
    m_buffers[i] = WTFMove(temp);
7815
    m_buffers[i] = { colorSpace, temp.releaseNonNull() };
7803
7816
7804
    ImageBuffer* buf = m_buffers[i].get();
7817
    ImageBuffer& buf = m_buffers[i]->second.get();
7805
    bubbleToFront(i);
7818
    bubbleToFront(i);
7806
    return buf;
7819
    return &buf;
7807
}
7820
}
7808
7821
7809
void WebGLRenderingContextBase::LRUImageBufferCache::bubbleToFront(size_t idx)
7822
void WebGLRenderingContextBase::LRUImageBufferCache::bubbleToFront(size_t idx)
- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.h -2 / +2 lines
Lines 620-629 protected: a/Source/WebCore/html/canvas/WebGLRenderingContextBase.h_sec1
620
        LRUImageBufferCache(int capacity);
620
        LRUImageBufferCache(int capacity);
621
        // Returns pointer to a cleared image buffer that is owned by the cache. The pointer is valid until next call.
621
        // Returns pointer to a cleared image buffer that is owned by the cache. The pointer is valid until next call.
622
        // Using fillOperator == CompositeOperator::Copy can be used to omit the clear of the buffer.
622
        // Using fillOperator == CompositeOperator::Copy can be used to omit the clear of the buffer.
623
        ImageBuffer* imageBuffer(const IntSize&, CompositeOperator fillOperator = CompositeOperator::SourceOver);
623
        ImageBuffer* imageBuffer(const IntSize&, DestinationColorSpace, CompositeOperator fillOperator = CompositeOperator::SourceOver);
624
    private:
624
    private:
625
        void bubbleToFront(size_t idx);
625
        void bubbleToFront(size_t idx);
626
        Vector<RefPtr<ImageBuffer>> m_buffers;
626
        Vector<std::optional<std::pair<DestinationColorSpace, Ref<ImageBuffer>>>> m_buffers;
627
    };
627
    };
628
    LRUImageBufferCache m_generatedImageCache { 0 };
628
    LRUImageBufferCache m_generatedImageCache { 0 };
629
629
- a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp -1 / +6 lines
Lines 32-38 typedef struct __IOSurface* IOSurfaceRef; a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp_sec1
32
32
33
SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, CoreVideo)
33
SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, CoreVideo)
34
34
35
#if HAVE(CVBUFFERCOPYATTACHMENTS)
36
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferCopyAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode))
37
#endif
35
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode))
38
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode))
39
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferGetAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode))
36
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ())
40
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ())
37
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
41
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
38
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetHeight, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
42
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetHeight, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
Lines 46-52 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferUnlockBaseAddress a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp_sec2
46
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferPoolCreate, CVReturn,(CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef* poolOut), (allocator, poolAttributes, pixelBufferAttributes, poolOut))
50
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferPoolCreate, CVReturn,(CFAllocatorRef allocator, CFDictionaryRef poolAttributes, CFDictionaryRef pixelBufferAttributes, CVPixelBufferPoolRef* poolOut), (allocator, poolAttributes, pixelBufferAttributes, poolOut))
47
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferPoolCreatePixelBuffer, CVReturn, (CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef* pixelBufferOut), (allocator, pixelBufferPool, pixelBufferOut))
51
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferPoolCreatePixelBuffer, CVReturn, (CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef* pixelBufferOut), (allocator, pixelBufferPool, pixelBufferOut))
48
SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, CVPixelBufferGetIOSurface, IOSurfaceRef, (CVPixelBufferRef pixelBuffer), (pixelBuffer), WEBCORE_EXPORT)
52
SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, CVPixelBufferGetIOSurface, IOSurfaceRef, (CVPixelBufferRef pixelBuffer), (pixelBuffer), WEBCORE_EXPORT)
49
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVImageBufferGetColorSpace, CGColorSpaceRef, (CVImageBufferRef pixelBuffer), (pixelBuffer))
53
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVImageBufferCreateColorSpaceFromAttachments, CGColorSpaceRef, (CFDictionaryRef attachments), (attachments))
50
54
51
SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef, WEBCORE_EXPORT)
55
SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef, WEBCORE_EXPORT)
52
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVPixelBufferCGBitmapContextCompatibilityKey, CFStringRef)
56
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVPixelBufferCGBitmapContextCompatibilityKey, CFStringRef)
Lines 72-77 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferTransferFunction a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp_sec3
72
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
76
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
73
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
77
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
74
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
78
SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
79
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferCGColorSpaceKey, CFStringRef)
75
80
76
#if USE(OPENGL_ES)
81
#if USE(OPENGL_ES)
77
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVOpenGLESTextureCacheCreate, CVReturn, (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CVEAGLContext eaglContext, CFDictionaryRef textureAttributes, CVOpenGLESTextureCacheRef* cacheOut), (allocator, cacheAttributes, eaglContext, textureAttributes, cacheOut))
82
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVOpenGLESTextureCacheCreate, CVReturn, (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CVEAGLContext eaglContext, CFDictionaryRef textureAttributes, CVOpenGLESTextureCacheRef* cacheOut), (allocator, cacheAttributes, eaglContext, textureAttributes, cacheOut))
- a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h -2 / +10 lines
Lines 32-39 typedef struct __IOSurface* IOSurfaceRef; a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h_sec1
32
32
33
SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, CoreVideo)
33
SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, CoreVideo)
34
34
35
#if HAVE(CVBUFFERCOPYATTACHMENTS)
36
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferCopyAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode))
37
#define CVBufferCopyAttachments softLink_CoreVideo_CVBufferCopyAttachments
38
#endif
35
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode))
39
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode))
36
#define CVBufferGetAttachment softLink_CoreVideo_CVBufferGetAttachment
40
#define CVBufferGetAttachment softLink_CoreVideo_CVBufferGetAttachment
41
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferGetAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode))
42
#define CVBufferGetAttachments softLink_CoreVideo_CVBufferGetAttachments
37
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ())
43
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ())
38
#define CVPixelBufferGetTypeID softLink_CoreVideo_CVPixelBufferGetTypeID
44
#define CVPixelBufferGetTypeID softLink_CoreVideo_CVPixelBufferGetTypeID
39
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
45
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer))
Lines 62-69 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetIOSurface, IOS a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h_sec2
62
#define CVPixelBufferGetIOSurface softLink_CoreVideo_CVPixelBufferGetIOSurface
68
#define CVPixelBufferGetIOSurface softLink_CoreVideo_CVPixelBufferGetIOSurface
63
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferPoolGetPixelBufferAttributes, CFDictionaryRef, (CVPixelBufferPoolRef pool), (pool))
69
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferPoolGetPixelBufferAttributes, CFDictionaryRef, (CVPixelBufferPoolRef pool), (pool))
64
#define CVPixelBufferPoolGetPixelBufferAttributes softLink_CoreVideo_CVPixelBufferPoolGetPixelBufferAttributes
70
#define CVPixelBufferPoolGetPixelBufferAttributes softLink_CoreVideo_CVPixelBufferPoolGetPixelBufferAttributes
65
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVImageBufferGetColorSpace, CGColorSpaceRef, (CVImageBufferRef pixelBuffer), (pixelBuffer))
71
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVImageBufferCreateColorSpaceFromAttachments, CGColorSpaceRef, (CFDictionaryRef attachments), (attachments))
66
#define CVImageBufferGetColorSpace softLink_CoreVideo_CVImageBufferGetColorSpace
72
#define CVImageBufferCreateColorSpaceFromAttachments softLink_CoreVideo_CVImageBufferCreateColorSpaceFromAttachments
67
73
68
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef)
74
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef)
69
#define kCVPixelBufferPixelFormatTypeKey get_CoreVideo_kCVPixelBufferPixelFormatTypeKey()
75
#define kCVPixelBufferPixelFormatTypeKey get_CoreVideo_kCVPixelBufferPixelFormatTypeKey()
Lines 111-116 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferTransferFunction a/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h_sec3
111
#define kCVImageBufferTransferFunction_ITU_R_709_2 get_CoreVideo_kCVImageBufferTransferFunction_ITU_R_709_2()
117
#define kCVImageBufferTransferFunction_ITU_R_709_2 get_CoreVideo_kCVImageBufferTransferFunction_ITU_R_709_2()
112
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferTransferFunction_SMPTE_240M_1995, CFStringRef)
118
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferTransferFunction_SMPTE_240M_1995, CFStringRef)
113
#define kCVImageBufferTransferFunction_SMPTE_240M_1995 get_CoreVideo_kCVImageBufferTransferFunction_SMPTE_240M_1995()
119
#define kCVImageBufferTransferFunction_SMPTE_240M_1995 get_CoreVideo_kCVImageBufferTransferFunction_SMPTE_240M_1995()
120
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferCGColorSpaceKey, CFStringRef)
121
#define kCVImageBufferCGColorSpaceKey get_CoreVideo_kCVImageBufferCGColorSpaceKey()
114
122
115
#if USE(OPENGL_ES)
123
#if USE(OPENGL_ES)
116
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVOpenGLESTextureCacheCreate, CVReturn, (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CVEAGLContext eaglContext, CFDictionaryRef textureAttributes, CVOpenGLESTextureCacheRef* cacheOut), (allocator, cacheAttributes, eaglContext, textureAttributes, cacheOut))
124
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVOpenGLESTextureCacheCreate, CVReturn, (CFAllocatorRef allocator, CFDictionaryRef cacheAttributes, CVEAGLContext eaglContext, CFDictionaryRef textureAttributes, CVOpenGLESTextureCacheRef* cacheOut), (allocator, cacheAttributes, eaglContext, textureAttributes, cacheOut))
- a/Source/WebCore/platform/graphics/BitmapImage.cpp -2 / +1 lines
Lines 228-238 static inline void drawNativeImage(NativeImage& image, GraphicsContext& context, a/Source/WebCore/platform/graphics/BitmapImage.cpp_sec1
228
    context.drawNativeImage(image, subsampledImageSize, destRect, adjustedSrcRect, options);
228
    context.drawNativeImage(image, subsampledImageSize, destRect, adjustedSrcRect, options);
229
}
229
}
230
230
231
ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& requestedSrcRect, const ImagePaintingOptions& options)
231
ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& requestedSrcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
232
{
232
{
233
    if (destRect.isEmpty() || requestedSrcRect.isEmpty())
233
    if (destRect.isEmpty() || requestedSrcRect.isEmpty())
234
        return ImageDrawResult::DidNothing;
234
        return ImageDrawResult::DidNothing;
235
236
    
235
    
237
    auto srcRect = requestedSrcRect;
236
    auto srcRect = requestedSrcRect;
238
    auto preferredSize = size();
237
    auto preferredSize = size();
- a/Source/WebCore/platform/graphics/BitmapImage.h -1 / +1 lines
Lines 175-181 private: a/Source/WebCore/platform/graphics/BitmapImage.h_sec1
175
    FloatSize sourceSize(ImageOrientation orientation = ImageOrientation::FromImage) const final { return m_source->sourceSize(orientation); }
175
    FloatSize sourceSize(ImageOrientation orientation = ImageOrientation::FromImage) const final { return m_source->sourceSize(orientation); }
176
    bool hasDensityCorrectedSize() const override { return m_source->hasDensityCorrectedSize(); }
176
    bool hasDensityCorrectedSize() const override { return m_source->hasDensityCorrectedSize(); }
177
177
178
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override;
178
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) override;
179
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
179
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
180
#if PLATFORM(WIN)
180
#if PLATFORM(WIN)
181
    void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) override;
181
    void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) override;
- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp -1 / +1 lines
Lines 87-93 void CrossfadeGeneratedImage::drawCrossfade(GraphicsContext& context) a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp_sec1
87
    context.endTransparencyLayer();
87
    context.endTransparencyLayer();
88
}
88
}
89
89
90
ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
90
ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
91
{
91
{
92
    GraphicsContextStateSaver stateSaver(context);
92
    GraphicsContextStateSaver stateSaver(context);
93
    context.setCompositeOperation(options.compositeOperator(), options.blendMode());
93
    context.setCompositeOperation(options.compositeOperator(), options.blendMode());
- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h -1 / +1 lines
Lines 47-53 public: a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h_sec1
47
    FloatSize size(ImageOrientation = ImageOrientation::FromImage) const override { return m_crossfadeSize; }
47
    FloatSize size(ImageOrientation = ImageOrientation::FromImage) const override { return m_crossfadeSize; }
48
48
49
private:
49
private:
50
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override;
50
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) override;
51
    void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
51
    void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
52
52
53
    CrossfadeGeneratedImage(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&);
53
    CrossfadeGeneratedImage(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&);
- a/Source/WebCore/platform/graphics/GeneratedImage.h -1 / +1 lines
Lines 46-52 public: a/Source/WebCore/platform/graphics/GeneratedImage.h_sec1
46
    void destroyDecodedData(bool /*destroyAll*/ = true) override { }
46
    void destroyDecodedData(bool /*destroyAll*/ = true) override { }
47
47
48
protected:
48
protected:
49
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override = 0;
49
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) override = 0;
50
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override = 0;
50
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override = 0;
51
51
52
    // FIXME: Implement this to be less conservative.
52
    // FIXME: Implement this to be less conservative.
- a/Source/WebCore/platform/graphics/GradientImage.cpp -1 / +1 lines
Lines 40-46 GradientImage::GradientImage(Gradient& generator, const FloatSize& size) a/Source/WebCore/platform/graphics/GradientImage.cpp_sec1
40
40
41
GradientImage::~GradientImage() = default;
41
GradientImage::~GradientImage() = default;
42
42
43
ImageDrawResult GradientImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
43
ImageDrawResult GradientImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
44
{
44
{
45
    GraphicsContextStateSaver stateSaver(destContext);
45
    GraphicsContextStateSaver stateSaver(destContext);
46
    destContext.setCompositeOperation(options.compositeOperator(), options.blendMode());
46
    destContext.setCompositeOperation(options.compositeOperator(), options.blendMode());
- a/Source/WebCore/platform/graphics/GradientImage.h -1 / +1 lines
Lines 46-52 public: a/Source/WebCore/platform/graphics/GradientImage.h_sec1
46
private:
46
private:
47
    GradientImage(Gradient&, const FloatSize&);
47
    GradientImage(Gradient&, const FloatSize&);
48
48
49
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
49
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) final;
50
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
50
    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
51
    bool isGradientImage() const final { return true; }
51
    bool isGradientImage() const final { return true; }
52
    void dump(WTF::TextStream&) const final;
52
    void dump(WTF::TextStream&) const final;
- a/Source/WebCore/platform/graphics/GraphicsContext.cpp -2 / +2 lines
Lines 539-548 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destin a/Source/WebCore/platform/graphics/GraphicsContext.cpp_sec1
539
    return drawImage(image, destination, srcRect, imagePaintingOptions);
539
    return drawImage(image, destination, srcRect, imagePaintingOptions);
540
}
540
}
541
541
542
ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)
542
ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options, std::optional<DestinationColorSpace> colorSpaceHint)
543
{
543
{
544
    InterpolationQualityMaintainer interpolationQualityForThisScope(*this, options.interpolationQuality());
544
    InterpolationQualityMaintainer interpolationQualityForThisScope(*this, options.interpolationQuality());
545
    return image.draw(*this, destination, source, options);
545
    return image.draw(*this, destination, source, options, colorSpaceHint);
546
}
546
}
547
547
548
ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& options)
548
ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& options)
- a/Source/WebCore/platform/graphics/GraphicsContext.h -1 / +1 lines
Lines 428-434 public: a/Source/WebCore/platform/graphics/GraphicsContext.h_sec1
428
428
429
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatPoint& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
429
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatPoint& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
430
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
430
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
431
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::FromImage });
431
    WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::FromImage }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt);
432
432
433
    WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { });
433
    WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { });
434
    WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { });
434
    WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { });
- a/Source/WebCore/platform/graphics/Image.h -1 / +1 lines
Lines 200-206 protected: a/Source/WebCore/platform/graphics/Image.h_sec1
200
#if PLATFORM(WIN)
200
#if PLATFORM(WIN)
201
    virtual void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) { }
201
    virtual void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) { }
202
#endif
202
#endif
203
    virtual ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) = 0;
203
    virtual ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) = 0;
204
    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { });
204
    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { });
205
    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, const ImagePaintingOptions& = { });
205
    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, const ImagePaintingOptions& = { });
206
206
- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +5 lines
Lines 1072-1077 RefPtr<NativeImage> MediaPlayer::nativeImageForCurrentTime() a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec1
1072
    return m_private->nativeImageForCurrentTime();
1072
    return m_private->nativeImageForCurrentTime();
1073
}
1073
}
1074
1074
1075
std::optional<DestinationColorSpace> MediaPlayer::colorSpace()
1076
{
1077
    return m_private->colorSpace();
1078
}
1079
1075
MediaPlayer::SupportsType MediaPlayer::supportsType(const MediaEngineSupportParameters& parameters)
1080
MediaPlayer::SupportsType MediaPlayer::supportsType(const MediaEngineSupportParameters& parameters)
1076
{
1081
{
1077
    // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty string if type is a type that the 
1082
    // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty string if type is a type that the 
- a/Source/WebCore/platform/graphics/MediaPlayer.h +2 lines
Lines 65-70 class AudioSourceProvider; a/Source/WebCore/platform/graphics/MediaPlayer.h_sec1
65
class AudioTrackPrivate;
65
class AudioTrackPrivate;
66
class CDMInstance;
66
class CDMInstance;
67
class CachedResourceLoader;
67
class CachedResourceLoader;
68
class DestinationColorSpace;
68
class GraphicsContextGL;
69
class GraphicsContextGL;
69
class GraphicsContext;
70
class GraphicsContext;
70
class InbandTextTrackPrivate;
71
class InbandTextTrackPrivate;
Lines 468-473 public: a/Source/WebCore/platform/graphics/MediaPlayer.h_sec2
468
#endif
469
#endif
469
470
470
    RefPtr<NativeImage> nativeImageForCurrentTime();
471
    RefPtr<NativeImage> nativeImageForCurrentTime();
472
    std::optional<DestinationColorSpace> colorSpace();
471
473
472
    using MediaPlayerEnums::NetworkState;
474
    using MediaPlayerEnums::NetworkState;
473
    NetworkState networkState();
475
    NetworkState networkState();
- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h +1 lines
Lines 182-187 public: a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h_sec1
182
    virtual RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() { return nullptr; }
182
    virtual RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() { return nullptr; }
183
#endif
183
#endif
184
    virtual RefPtr<NativeImage> nativeImageForCurrentTime() { return nullptr; }
184
    virtual RefPtr<NativeImage> nativeImageForCurrentTime() { return nullptr; }
185
    virtual std::optional<DestinationColorSpace> colorSpace() { return std::nullopt; }
185
186
186
    virtual void setPreload(MediaPlayer::Preload) { }
187
    virtual void setPreload(MediaPlayer::Preload) { }
187
188
- a/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp -1 / +1 lines
Lines 40-46 NamedImageGeneratedImage::NamedImageGeneratedImage(String name, const FloatSize& a/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp_sec1
40
    setContainerSize(size);
40
    setContainerSize(size);
41
}
41
}
42
42
43
ImageDrawResult NamedImageGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
43
ImageDrawResult NamedImageGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
44
{
44
{
45
#if USE(NEW_THEME) || PLATFORM(IOS_FAMILY)
45
#if USE(NEW_THEME) || PLATFORM(IOS_FAMILY)
46
    GraphicsContextStateSaver stateSaver(context);
46
    GraphicsContextStateSaver stateSaver(context);
- a/Source/WebCore/platform/graphics/NamedImageGeneratedImage.h -1 / +1 lines
Lines 39-45 public: a/Source/WebCore/platform/graphics/NamedImageGeneratedImage.h_sec1
39
    }
39
    }
40
40
41
private:
41
private:
42
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override;
42
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) override;
43
    void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
43
    void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
44
44
45
    NamedImageGeneratedImage(String name, const FloatSize&);
45
    NamedImageGeneratedImage(String name, const FloatSize&);
- a/Source/WebCore/platform/graphics/NullGraphicsContext.h -1 / +1 lines
Lines 116-122 private: a/Source/WebCore/platform/graphics/NullGraphicsContext.h_sec1
116
116
117
    ImageDrawResult drawImage(Image&, const FloatPoint&, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final { return ImageDrawResult::DidNothing; }
117
    ImageDrawResult drawImage(Image&, const FloatPoint&, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final { return ImageDrawResult::DidNothing; }
118
    ImageDrawResult drawImage(Image&, const FloatRect&, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final { return ImageDrawResult::DidNothing; }
118
    ImageDrawResult drawImage(Image&, const FloatRect&, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final { return ImageDrawResult::DidNothing; }
119
    ImageDrawResult drawImage(Image&, const FloatRect&, const FloatRect&, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final { return ImageDrawResult::DidNothing; }
119
    ImageDrawResult drawImage(Image&, const FloatRect&, const FloatRect&, const ImagePaintingOptions& = { ImageOrientation::FromImage }, std::optional<DestinationColorSpace> = std::nullopt) final { return ImageDrawResult::DidNothing; }
120
120
121
    ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions& = { }) final { return ImageDrawResult::DidNothing; }
121
    ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions& = { }) final { return ImageDrawResult::DidNothing; }
122
    ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { }) final { return ImageDrawResult::DidNothing; }
122
    ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { }) final { return ImageDrawResult::DidNothing; }
- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h +1 lines
Lines 257-262 private: a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h_sec1
257
    bool videoOutputHasAvailableFrame();
257
    bool videoOutputHasAvailableFrame();
258
    void paintWithVideoOutput(GraphicsContext&, const FloatRect&);
258
    void paintWithVideoOutput(GraphicsContext&, const FloatRect&);
259
    RefPtr<NativeImage> nativeImageForCurrentTime() final;
259
    RefPtr<NativeImage> nativeImageForCurrentTime() final;
260
    std::optional<DestinationColorSpace> colorSpace() final;
260
    void waitForVideoOutputMediaDataWillChange();
261
    void waitForVideoOutputMediaDataWillChange();
261
262
262
    RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() final;
263
    RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() final;
- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm +10 lines
Lines 36-41 a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm_sec1
36
#import "AuthenticationChallenge.h"
36
#import "AuthenticationChallenge.h"
37
#import "CDMInstanceFairPlayStreamingAVFObjC.h"
37
#import "CDMInstanceFairPlayStreamingAVFObjC.h"
38
#import "CDMSessionAVFoundationObjC.h"
38
#import "CDMSessionAVFoundationObjC.h"
39
#import "CVUtilities.h"
39
#import "ColorSpaceCG.h"
40
#import "ColorSpaceCG.h"
40
#import "Cookie.h"
41
#import "Cookie.h"
41
#import "DeprecatedGlobalSettings.h"
42
#import "DeprecatedGlobalSettings.h"
Lines 2599-2604 RefPtr<NativeImage> MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTim a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm_sec2
2599
    return m_lastImage;
2600
    return m_lastImage;
2600
}
2601
}
2601
2602
2603
std::optional<DestinationColorSpace> MediaPlayerPrivateAVFoundationObjC::colorSpace()
2604
{
2605
    updateLastImage(UpdateType::UpdateSynchronously);
2606
    if (!m_lastPixelBuffer)
2607
        return std::nullopt;
2608
2609
    return DestinationColorSpace(createCGColorSpaceForCVPixelBuffer(m_lastPixelBuffer.get()));
2610
}
2611
2602
void MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange()
2612
void MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange()
2603
{
2613
{
2604
    [m_videoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:0];
2614
    [m_videoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:0];
- a/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h -1 / +3 lines
Lines 26-34 a/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h_sec1
26
#pragma once
26
#pragma once
27
27
28
#include "ColorSpace.h"
28
#include "ColorSpace.h"
29
#include <CoreGraphics/CoreGraphics.h>
29
#include <optional>
30
#include <optional>
31
#include <wtf/cf/TypeCastsCF.h>
30
32
31
typedef struct CGColorSpace *CGColorSpaceRef;
33
WTF_DECLARE_CF_TYPE_TRAIT(CGColorSpace);
32
34
33
namespace WebCore {
35
namespace WebCore {
34
36
- a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp -1 / +1 lines
Lines 263-269 void PDFDocumentImage::updateCachedImageIfNeeded(GraphicsContext& context, const a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp_sec1
263
    decodedSizeChanged(backendSize.unclampedArea() * 4);
263
    decodedSizeChanged(backendSize.unclampedArea() * 4);
264
}
264
}
265
265
266
ImageDrawResult PDFDocumentImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
266
ImageDrawResult PDFDocumentImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace>)
267
{
267
{
268
    if (!m_document || !m_hasPage)
268
    if (!m_document || !m_hasPage)
269
        return ImageDrawResult::DidNothing;
269
        return ImageDrawResult::DidNothing;
- a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h -1 / +1 lines
Lines 81-87 private: a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h_sec1
81
    void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
81
    void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
82
    FloatSize size(ImageOrientation = ImageOrientation::FromImage) const override;
82
    FloatSize size(ImageOrientation = ImageOrientation::FromImage) const override;
83
83
84
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override;
84
    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) override;
85
85
86
    // FIXME: Implement this to be less conservative.
86
    // FIXME: Implement this to be less conservative.
87
    bool currentFrameKnownToBeOpaque() const override { return false; }
87
    bool currentFrameKnownToBeOpaque() const override { return false; }
- a/Source/WebCore/platform/graphics/cv/CVUtilities.h +2 lines
Lines 30-35 a/Source/WebCore/platform/graphics/cv/CVUtilities.h_sec1
30
#include <wtf/Expected.h>
30
#include <wtf/Expected.h>
31
#include <wtf/RetainPtr.h>
31
#include <wtf/RetainPtr.h>
32
32
33
using CGColorSpaceRef = struct CGColorSpace*;
33
using CVPixelBufferPoolRef = struct __CVPixelBufferPool*;
34
using CVPixelBufferPoolRef = struct __CVPixelBufferPool*;
34
using CVPixelBufferRef = struct __CVBuffer*;
35
using CVPixelBufferRef = struct __CVBuffer*;
35
36
Lines 43-46 WEBCORE_EXPORT Expected<RetainPtr<CVPixelBufferRef>, CVReturn> createCVPixelBuff a/Source/WebCore/platform/graphics/cv/CVUtilities.h_sec2
43
44
44
WEBCORE_EXPORT Expected<RetainPtr<CVPixelBufferRef>, CVReturn> createCVPixelBuffer(IOSurfaceRef);
45
WEBCORE_EXPORT Expected<RetainPtr<CVPixelBufferRef>, CVReturn> createCVPixelBuffer(IOSurfaceRef);
45
46
47
RetainPtr<CGColorSpaceRef> createCGColorSpaceForCVPixelBuffer(CVPixelBufferRef);
46
}
48
}
- a/Source/WebCore/platform/graphics/cv/CVUtilities.mm +17 lines
Lines 107-110 Expected<RetainPtr<CVPixelBufferRef>, CVReturn> createCVPixelBuffer(IOSurfaceRef a/Source/WebCore/platform/graphics/cv/CVUtilities.mm_sec1
107
    return adoptCF(pixelBuffer);
107
    return adoptCF(pixelBuffer);
108
}
108
}
109
109
110
RetainPtr<CGColorSpaceRef> createCGColorSpaceForCVPixelBuffer(CVPixelBufferRef buffer)
111
{
112
    if (CGColorSpaceRef colorSpace = dynamic_cf_cast<CGColorSpaceRef>(CVBufferGetAttachment(buffer, kCVImageBufferCGColorSpaceKey, nullptr)))
113
        return colorSpace;
114
115
    RetainPtr<CFDictionaryRef> attachments;
116
#if HAVE(CVBUFFERCOPYATTACHMENTS)
117
    attachments = adoptCF(CVBufferCopyAttachments(buffer, kCVAttachmentMode_ShouldPropagate));
118
#else
119
    attachments = CVBufferGetAttachments(buffer, kCVAttachmentMode_ShouldPropagate);
120
#endif
121
    if (auto colorSpace = adoptCF(CVImageBufferCreateColorSpaceFromAttachments(attachments.get())))
122
        return colorSpace;
123
124
    return sRGBColorSpaceRef();
125
}
126
110
}
127
}
- a/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp -1 / +4 lines
Lines 26-31 a/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp_sec1
26
#include "config.h"
26
#include "config.h"
27
#include "PixelBufferConformerCV.h"
27
#include "PixelBufferConformerCV.h"
28
28
29
#include "CVUtilities.h"
29
#include "GraphicsContextCG.h"
30
#include "GraphicsContextCG.h"
30
#include "ImageBufferUtilitiesCG.h"
31
#include "ImageBufferUtilitiesCG.h"
31
#include "Logging.h"
32
#include "Logging.h"
Lines 165-170 RetainPtr<CGImageRef> PixelBufferConformerCV::createImageFromPixelBuffer(CVPixel a/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp_sec2
165
    if (!byteLength)
166
    if (!byteLength)
166
        return nullptr;
167
        return nullptr;
167
168
169
    auto colorSpace = createCGColorSpaceForCVPixelBuffer(rawBuffer);
170
168
    CVPixelBufferInfo* info = new CVPixelBufferInfo();
171
    CVPixelBufferInfo* info = new CVPixelBufferInfo();
169
    info->pixelBuffer = WTFMove(buffer);
172
    info->pixelBuffer = WTFMove(buffer);
170
    info->lockCount = 0;
173
    info->lockCount = 0;
Lines 172-178 RetainPtr<CGImageRef> PixelBufferConformerCV::createImageFromPixelBuffer(CVPixel a/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp_sec3
172
    CGDataProviderDirectCallbacks providerCallbacks = { 0, CVPixelBufferGetBytePointerCallback, CVPixelBufferReleaseBytePointerCallback, 0, CVPixelBufferReleaseInfoCallback };
175
    CGDataProviderDirectCallbacks providerCallbacks = { 0, CVPixelBufferGetBytePointerCallback, CVPixelBufferReleaseBytePointerCallback, 0, CVPixelBufferReleaseInfoCallback };
173
    RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateDirect(info, byteLength, &providerCallbacks));
176
    RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateDirect(info, byteLength, &providerCallbacks));
174
177
175
    return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, sRGBColorSpaceRef(), bitmapInfo, provider.get(), nullptr, false, kCGRenderingIntentDefault));
178
    return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, colorSpace.get(), bitmapInfo, provider.get(), nullptr, false, kCGRenderingIntentDefault));
176
}
179
}
177
180
178
}
181
}
- a/Source/WebCore/svg/graphics/SVGImage.cpp -10 / +11 lines
Lines 176-183 IntSize SVGImage::containerSize() const a/Source/WebCore/svg/graphics/SVGImage.cpp_sec1
176
    return IntSize(currentSize);
176
    return IntSize(currentSize);
177
}
177
}
178
178
179
ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect,
179
ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace> colorSpaceHint)
180
    const FloatRect& srcRect, const ImagePaintingOptions& options)
181
{
180
{
182
    if (!m_page)
181
    if (!m_page)
183
        return ImageDrawResult::DidNothing;
182
        return ImageDrawResult::DidNothing;
Lines 201-207 ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const Float a/Source/WebCore/svg/graphics/SVGImage.cpp_sec2
201
200
202
    frameView()->scrollToFragment(initialFragmentURL);
201
    frameView()->scrollToFragment(initialFragmentURL);
203
202
204
    ImageDrawResult result = draw(context, dstRect, scaledSrc, options);
203
    ImageDrawResult result = draw(context, dstRect, scaledSrc, options, colorSpaceHint);
205
204
206
    setImageObserver(observer);
205
    setImageObserver(observer);
207
    return result;
206
    return result;
Lines 214-228 RefPtr<NativeImage> SVGImage::nativeImageForCurrentFrame(const GraphicsContext* a/Source/WebCore/svg/graphics/SVGImage.cpp_sec3
214
213
215
RefPtr<NativeImage> SVGImage::nativeImage(const GraphicsContext*)
214
RefPtr<NativeImage> SVGImage::nativeImage(const GraphicsContext*)
216
{
215
{
217
    return nativeImage(size(), FloatRect(FloatPoint(), size()));
216
    return nativeImage(size(), FloatRect(FloatPoint(), size()), DestinationColorSpace::SRGB());
218
}
217
}
219
218
220
RefPtr<NativeImage> SVGImage::nativeImage(const FloatSize& imageSize, const FloatRect& sourceRect)
219
RefPtr<NativeImage> SVGImage::nativeImage(const FloatSize& imageSize, const FloatRect& sourceRect, DestinationColorSpace colorSpace)
221
{
220
{
222
    if (!m_page)
221
    if (!m_page)
223
        return nullptr;
222
        return nullptr;
224
223
225
    auto imageBuffer = ImageBuffer::create(imageSize, RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8);
224
    auto imageBuffer = ImageBuffer::create(imageSize, RenderingMode::Unaccelerated, 1, colorSpace, PixelFormat::BGRA8);
226
    if (!imageBuffer)
225
    if (!imageBuffer)
227
        return nullptr;
226
        return nullptr;
228
227
Lines 275-281 void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize a/Source/WebCore/svg/graphics/SVGImage.cpp_sec4
275
    image->drawPattern(context, dstRect, scaledSrcRect, unscaledPatternTransform, phase, spacing, options);
274
    image->drawPattern(context, dstRect, scaledSrcRect, unscaledPatternTransform, phase, spacing, options);
276
}
275
}
277
276
278
ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
277
ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace> colorSpaceHint)
279
{
278
{
280
    if (!m_page)
279
    if (!m_page)
281
        return ImageDrawResult::DidNothing;
280
        return ImageDrawResult::DidNothing;
Lines 283-289 ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec a/Source/WebCore/svg/graphics/SVGImage.cpp_sec5
283
    if (!context.hasPlatformContext()) {
282
    if (!context.hasPlatformContext()) {
284
        // Display list drawing can't handle arbitrary DOM content.
283
        // Display list drawing can't handle arbitrary DOM content.
285
        // FIXME https://bugs.webkit.org/show_bug.cgi?id=227748: Remove this when it can.
284
        // FIXME https://bugs.webkit.org/show_bug.cgi?id=227748: Remove this when it can.
286
        return drawAsNativeImage(context, dstRect, srcRect, options);
285
        auto colorSpace = colorSpaceHint ? *colorSpaceHint : DestinationColorSpace::SRGB();
286
        return drawAsNativeImage(context, dstRect, srcRect, options, colorSpace);
287
    }
287
    }
288
288
289
    RefPtr view = frameView();
289
    RefPtr view = frameView();
Lines 300-305 ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec a/Source/WebCore/svg/graphics/SVGImage.cpp_sec6
300
        context.setCompositeOperation(CompositeOperator::SourceOver, BlendMode::Normal);
300
        context.setCompositeOperation(CompositeOperator::SourceOver, BlendMode::Normal);
301
    }
301
    }
302
302
303
    // FIXME: We should honor options.orientation(), since ImageBitmap's flipY handling relies on it. https://bugs.webkit.org/show_bug.cgi?id=231001
303
    FloatSize scale(dstRect.size() / srcRect.size());
304
    FloatSize scale(dstRect.size() / srcRect.size());
304
    
305
    
305
    // We can only draw the entire frame, clipped to the rect we want. So compute where the top left
306
    // We can only draw the entire frame, clipped to the rect we want. So compute where the top left
Lines 336-347 ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec a/Source/WebCore/svg/graphics/SVGImage.cpp_sec7
336
}
337
}
337
338
338
339
339
ImageDrawResult SVGImage::drawAsNativeImage(GraphicsContext& context, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)
340
ImageDrawResult SVGImage::drawAsNativeImage(GraphicsContext& context, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options, DestinationColorSpace colorSpace)
340
{
341
{
341
    ASSERT(!context.hasPlatformContext());
342
    ASSERT(!context.hasPlatformContext());
342
343
343
    auto rectInNativeImage = FloatRect { { }, destination.size() };
344
    auto rectInNativeImage = FloatRect { { }, destination.size() };
344
    auto nativeImage = this->nativeImage(rectInNativeImage.size(), source);
345
    auto nativeImage = this->nativeImage(rectInNativeImage.size(), source, colorSpace);
345
    if (!nativeImage)
346
    if (!nativeImage)
346
        return ImageDrawResult::DidNothing;
347
        return ImageDrawResult::DidNothing;
347
348
- a/Source/WebCore/svg/graphics/SVGImage.h -4 / +4 lines
Lines 88-101 private: a/Source/WebCore/svg/graphics/SVGImage.h_sec1
88
88
89
    RefPtr<NativeImage> nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
89
    RefPtr<NativeImage> nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
90
    RefPtr<NativeImage> nativeImage(const GraphicsContext* = nullptr) final;
90
    RefPtr<NativeImage> nativeImage(const GraphicsContext* = nullptr) final;
91
    RefPtr<NativeImage> nativeImage(const FloatSize& imageSize, const FloatRect& sourceRect);
91
    RefPtr<NativeImage> nativeImage(const FloatSize& imageSize, const FloatRect& sourceRect, DestinationColorSpace);
92
92
93
    void startAnimationTimerFired();
93
    void startAnimationTimerFired();
94
94
95
    WEBCORE_EXPORT explicit SVGImage(ImageObserver&);
95
    WEBCORE_EXPORT explicit SVGImage(ImageObserver&);
96
    ImageDrawResult draw(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { }) final;
96
    ImageDrawResult draw(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) final;
97
    ImageDrawResult drawAsNativeImage(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { });
97
    ImageDrawResult drawAsNativeImage(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace);
98
    ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { });
98
    ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt);
99
    void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const FloatRect&, const ImagePaintingOptions& = { });
99
    void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const FloatRect&, const ImagePaintingOptions& = { });
100
100
101
    RefPtr<SVGSVGElement> rootElement() const;
101
    RefPtr<SVGSVGElement> rootElement() const;
- a/Source/WebCore/svg/graphics/SVGImageForContainer.cpp -2 / +2 lines
Lines 43-51 FloatSize SVGImageForContainer::size(ImageOrientation) const a/Source/WebCore/svg/graphics/SVGImageForContainer.cpp_sec1
43
    return FloatSize(roundedIntSize(scaledContainerSize));
43
    return FloatSize(roundedIntSize(scaledContainerSize));
44
}
44
}
45
45
46
ImageDrawResult SVGImageForContainer::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
46
ImageDrawResult SVGImageForContainer::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options, std::optional<DestinationColorSpace> colorSpaceHint)
47
{
47
{
48
    return m_image->drawForContainer(context, m_containerSize, m_containerZoom, m_initialFragmentURL, dstRect, srcRect, options);
48
    return m_image->drawForContainer(context, m_containerSize, m_containerZoom, m_initialFragmentURL, dstRect, srcRect, options, colorSpaceHint);
49
}
49
}
50
50
51
void SVGImageForContainer::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
51
void SVGImageForContainer::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
- a/Source/WebCore/svg/graphics/SVGImageForContainer.h -1 / +1 lines
Lines 53-59 public: a/Source/WebCore/svg/graphics/SVGImageForContainer.h_sec1
53
        m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
53
        m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
54
    }
54
    }
55
55
56
    ImageDrawResult draw(GraphicsContext&, const FloatRect&, const FloatRect&, const ImagePaintingOptions& = { }) final;
56
    ImageDrawResult draw(GraphicsContext&, const FloatRect&, const FloatRect&, const ImagePaintingOptions& = { }, std::optional<DestinationColorSpace> colorSpaceHint = std::nullopt) final;
57
57
58
    void drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions& = { }) final;
58
    void drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions& = { }) final;
59
59
- a/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h -1 / +2 lines
Lines 311-317 private: a/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h_sec1
311
    void currentTimeChanged(const MediaTime&);
311
    void currentTimeChanged(const MediaTime&);
312
312
313
#if PLATFORM(COCOA)
313
#if PLATFORM(COCOA)
314
    void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&)>&&);
314
    void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, std::optional<WebCore::DestinationColorSpace>&&)>&&);
315
    void colorSpace(CompletionHandler<void(std::optional<WebCore::DestinationColorSpace>&&)>&&);
315
#endif
316
#endif
316
#if USE(AVFOUNDATION)
317
#if USE(AVFOUNDATION)
317
    void pixelBufferForCurrentTime(CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&&);
318
    void pixelBufferForCurrentTime(CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&&);
- a/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in -1 / +2 lines
Lines 123-129 messages -> RemoteMediaPlayerProxy NotRefCounted { a/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in_sec1
123
#endif
123
#endif
124
124
125
#if PLATFORM(COCOA)
125
#if PLATFORM(COCOA)
126
    NativeImageForCurrentTime() -> (std::optional<MachSendRight> sendRight) Synchronous
126
    NativeImageForCurrentTime() -> (std::optional<MachSendRight> sendRight, std::optional<WebCore::DestinationColorSpace> colorSpace) Synchronous
127
    ColorSpace() -> (std::optional<WebCore::DestinationColorSpace> colorSpace) Synchronous
127
#endif
128
#endif
128
#if USE(AVFOUNDATION)
129
#if USE(AVFOUNDATION)
129
    PixelBufferForCurrentTime() -> (RetainPtr<CVPixelBufferRef> pixelBuffer) Synchronous
130
    PixelBufferForCurrentTime() -> (RetainPtr<CVPixelBufferRef> pixelBuffer) Synchronous
- a/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm -5 / +15 lines
Lines 83-114 void RemoteMediaPlayerProxy::setVideoInlineSizeFenced(const WebCore::FloatSize& a/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm_sec1
83
    setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, size);
83
    setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, size);
84
}
84
}
85
85
86
void RemoteMediaPlayerProxy::nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&)>&& completionHandler)
86
void RemoteMediaPlayerProxy::nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, std::optional<WebCore::DestinationColorSpace>&&)>&& completionHandler)
87
{
87
{
88
    if (!m_player) {
88
    if (!m_player) {
89
        completionHandler(std::nullopt);
89
        completionHandler(std::nullopt, std::nullopt);
90
        return;
90
        return;
91
    }
91
    }
92
92
93
    auto nativeImage = m_player->nativeImageForCurrentTime();
93
    auto nativeImage = m_player->nativeImageForCurrentTime();
94
    if (!nativeImage) {
94
    if (!nativeImage) {
95
        completionHandler(std::nullopt);
95
        completionHandler(std::nullopt, std::nullopt);
96
        return;
96
        return;
97
    }
97
    }
98
98
99
    auto platformImage = nativeImage->platformImage();
99
    auto platformImage = nativeImage->platformImage();
100
    if (!platformImage) {
100
    if (!platformImage) {
101
        completionHandler(std::nullopt);
101
        completionHandler(std::nullopt, std::nullopt);
102
        return;
102
        return;
103
    }
103
    }
104
104
105
    auto surface = WebCore::IOSurface::createFromImage(platformImage.get());
105
    auto surface = WebCore::IOSurface::createFromImage(platformImage.get());
106
    if (!surface) {
106
    if (!surface) {
107
        completionHandler(std::nullopt, std::nullopt);
108
        return;
109
    }
110
111
    completionHandler(surface->createSendRight(), nativeImage->colorSpace());
112
}
113
114
void RemoteMediaPlayerProxy::colorSpace(CompletionHandler<void(std::optional<WebCore::DestinationColorSpace>&&)>&& completionHandler)
115
{
116
    if (!m_player) {
107
        completionHandler(std::nullopt);
117
        completionHandler(std::nullopt);
108
        return;
118
        return;
109
    }
119
    }
110
120
111
    completionHandler(surface->createSendRight());
121
    completionHandler(m_player->colorSpace());
112
}
122
}
113
123
114
void RemoteMediaPlayerProxy::pixelBufferForCurrentTime(CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&& completionHandler)
124
void RemoteMediaPlayerProxy::pixelBufferForCurrentTime(CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&& completionHandler)
- a/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp +6 lines
Lines 991-996 RefPtr<NativeImage> MediaPlayerPrivateRemote::nativeImageForCurrentTime() a/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp_sec1
991
    notImplemented();
991
    notImplemented();
992
    return nullptr;
992
    return nullptr;
993
}
993
}
994
995
std::optional<WebCore::DestinationColorSpace> MediaPlayerPrivateRemote::colorSpace()
996
{
997
    notImplemented();
998
    return std::nullopt;
999
}
994
#endif
1000
#endif
995
1001
996
bool MediaPlayerPrivateRemote::hasAvailableVideoFrame() const
1002
bool MediaPlayerPrivateRemote::hasAvailableVideoFrame() const
- a/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h +1 lines
Lines 290-295 private: a/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h_sec1
290
    RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() final;
290
    RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() final;
291
#endif
291
#endif
292
    RefPtr<WebCore::NativeImage> nativeImageForCurrentTime() final;
292
    RefPtr<WebCore::NativeImage> nativeImageForCurrentTime() final;
293
    std::optional<WebCore::DestinationColorSpace> colorSpace() final;
293
294
294
    WebCore::MediaPlayerIdentifier identifier() const final;
295
    WebCore::MediaPlayerIdentifier identifier() const final;
295
296
- a/Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm -3 / +13 lines
Lines 49-61 PlatformLayerContainer MediaPlayerPrivateRemote::createVideoFullscreenLayer() a/Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm_sec1
49
RefPtr<NativeImage> MediaPlayerPrivateRemote::nativeImageForCurrentTime()
49
RefPtr<NativeImage> MediaPlayerPrivateRemote::nativeImageForCurrentTime()
50
{
50
{
51
    std::optional<MachSendRight> sendRight;
51
    std::optional<MachSendRight> sendRight;
52
    if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime(), Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime::Reply(sendRight), m_id))
52
    std::optional<DestinationColorSpace> colorSpace;
53
    if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime(), Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime::Reply(sendRight, colorSpace), m_id))
53
        return nullptr;
54
        return nullptr;
54
55
55
    if (!sendRight)
56
    if (!sendRight || !colorSpace)
56
        return nullptr;
57
        return nullptr;
57
58
58
    auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(*sendRight), WebCore::DestinationColorSpace::SRGB());
59
    auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(*sendRight), *colorSpace);
59
    if (!surface)
60
    if (!surface)
60
        return nullptr;
61
        return nullptr;
61
62
Lines 66-71 RefPtr<NativeImage> MediaPlayerPrivateRemote::nativeImageForCurrentTime() a/Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm_sec2
66
    return NativeImage::create(WTFMove(platformImage));
67
    return NativeImage::create(WTFMove(platformImage));
67
}
68
}
68
69
70
std::optional<WebCore::DestinationColorSpace> MediaPlayerPrivateRemote::colorSpace()
71
{
72
    std::optional<DestinationColorSpace> colorSpace;
73
    if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::ColorSpace(), Messages::RemoteMediaPlayerProxy::ColorSpace::Reply(colorSpace), m_id))
74
        return std::nullopt;
75
76
    return colorSpace;
77
}
78
69
RetainPtr<CVPixelBufferRef> MediaPlayerPrivateRemote::pixelBufferForCurrentTime()
79
RetainPtr<CVPixelBufferRef> MediaPlayerPrivateRemote::pixelBufferForCurrentTime()
70
{
80
{
71
81
- a/LayoutTests/ChangeLog +58 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2021-09-28  Cameron McCormack  <heycam@apple.com>
2
3
        Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space
4
        https://bugs.webkit.org/show_bug.cgi?id=229025
5
        <rdar://problem/81828490>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * TestExpectations:
10
        * platform/glib/TestExpectations:
11
        * platform/ios-14/TestExpectations:
12
        * platform/ios-device/TestExpectations:
13
        * platform/ios/TestExpectations:
14
        * platform/mac-wk2/TestExpectations:
15
        * platform/mac/TestExpectations:
16
        New tests pass only on macOS Monterey+ and iOS 15+.
17
18
        * fast/canvas/canvas-createPattern-video-loading-expected.txt:
19
        * fast/canvas/canvas-createPattern-video-loading.html:
20
        * fast/canvas/canvas-createPattern-video-modify-expected.txt:
21
        * fast/canvas/canvas-createPattern-video-modify.html:
22
        * media/video-canvas-createPattern-expected.txt:
23
        * media/video-canvas-createPattern.html:
24
        * media/video-canvas-drawing-output-expected.txt:
25
        * media/video-canvas-drawing-output.html:
26
        * media/video-orientation-canvas-expected.txt:
27
        * media/video-orientation-canvas.html:
28
        Update some tests to check for correctly converted color values.
29
30
        * platform/mac/media/video-canvas-createPattern-expected.png: Removed.
31
        * platform/wpe/media/video-canvas-createPattern-expected.png: Removed.
32
33
        * platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt:
34
        An existing failure that changed a bit. This is
35
        https://bugs.webkit.org/show_bug.cgi?id=231001.
36
37
        * platform/mac-bigsur/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt:
38
        * platform/mac-bigsur/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt:
39
        * platform/mac-catalina/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt:
40
        * platform/mac-catalina/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt:
41
        * webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt:
42
        * webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt:
43
        New expected faillures for vendored tests that check for incorrect color
44
        space handling with drawImage() on a 2D canvas.
45
46
2021-09-30  Cameron McCormack  <heycam@apple.com>
47
48
        Choose an appropriate color space when converting an SVG image into a NativeImage for canvas drawImage
49
        https://bugs.webkit.org/show_bug.cgi?id=231062
50
        <rdar://problem/83752451>
51
52
        Reviewed by NOBODY (OOPS!).
53
54
        * TestExpectations:
55
        * platform/ios-14/TestExpectations:
56
        * platform/ios/TestExpectations:
57
        * platform/mac/TestExpectations:
58
1
2021-10-01  Commit Queue  <commit-queue@webkit.org>
59
2021-10-01  Commit Queue  <commit-queue@webkit.org>
2
60
3
        Unreviewed, reverting r283293.
61
        Unreviewed, reverting r283293.
- a/LayoutTests/imported/w3c/ChangeLog +55 lines
Lines 1-3 a/LayoutTests/imported/w3c/ChangeLog_sec1
1
2021-10-01  Cameron McCormack  <heycam@apple.com>
2
3
        Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space
4
        https://bugs.webkit.org/show_bug.cgi?id=229025
5
        <rdar://problem/81828490>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Add some new WPTs for drawImage(video).
10
11
        * web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html:
12
        * web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html:
13
        Updated tests to check that video color space conversion is done
14
        correctly.
15
16
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video-expected.txt: Added.
17
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html: Added.
18
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video-expected.txt: Added.
19
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html: Added.
20
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js:
21
        (pixelsApproximatelyEqual): Tweaked threshold to pass video tests on iOS.
22
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.mp4: Added.
23
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.webm: Added.
24
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.mp4: Added.
25
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.webm: Added.
26
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.mp4: Added.
27
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.webm: Added.
28
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.mp4: Added.
29
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.webm: Added.
30
31
2021-09-30  Cameron McCormack  <heycam@apple.com>
32
33
        Choose an appropriate color space when converting an SVG image into a NativeImage for canvas drawImage
34
        https://bugs.webkit.org/show_bug.cgi?id=231062
35
        <rdar://problem/83752451>
36
37
        Reviewed by NOBODY (OOPS!).
38
39
        Add a test for drawImage() with an SVG image that has sRGB and Display
40
        P3 colors.
41
42
        Not adding tests for patterns pointing to SVG images for now, since
43
        WebKit currently always taints the canvas in that case, or for
44
        ImageBitmaps wrapping SVG images, since we always flatten them to sRGB
45
        (and we don't track what content is inside the SVG to make a better
46
        decision about what color space ImageBuffer to use).
47
48
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-expected.txt.
49
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html.
50
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js:
51
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-0.7333-0-0.svg: Added.
52
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-1-0-0.svg: Added.
53
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.svg: Added.
54
        * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0000.svg: Added.
55
1
2021-10-01  Nikos Mouchtaris  <nmouchtaris@apple.com>
56
2021-10-01  Nikos Mouchtaris  <nmouchtaris@apple.com>
2
57
3
        Allow NaN, infinity, and -infinity in calc
58
        Allow NaN, infinity, and -infinity in calc
- a/LayoutTests/TestExpectations -1 / +3 lines
Lines 5085-5097 imported/w3c/web-platform-tests/css/css-color/predefined-013.html [ Skip ] a/LayoutTests/TestExpectations_sec1
5085
# display-p3 canvas and ImageData are Cocoa only for now.
5085
# display-p3 canvas and ImageData are Cocoa only for now.
5086
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
5086
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
5087
fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
5087
fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
5088
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html [ Failure ]
5088
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html [ Failure ]
5089
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Failure ]
5089
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Failure ]
5090
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Failure ]
5090
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Failure ]
5091
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Failure ]
5091
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Failure ]
5092
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Failure ]
5092
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Failure ]
5093
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ]
5093
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ]
5094
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ]
5094
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ]
5095
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Failure ]
5096
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Failure ]
5095
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ]
5097
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ]
5096
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ]
5098
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ]
5097
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Failure ]
5099
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Failure ]
- a/LayoutTests/fast/canvas/canvas-createPattern-video-loading-expected.txt -64 / +64 lines
Lines 4-81 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE a/LayoutTests/fast/canvas/canvas-createPattern-video-loading-expected.txt_sec1
4
4
5
5
6
PASS document.createElement('canvas').getContext('2d').createPattern(video, 'repeat') is null
6
PASS document.createElement('canvas').getContext('2d').createPattern(video, 'repeat') is null
7
PASS buffer[0] is within 2 of 194
7
PASS buffer[0] is within 2 of 200
8
PASS buffer[1] is within 2 of 193
9
PASS buffer[2] is within 2 of 14
10
PASS buffer[0] is within 2 of 194
11
PASS buffer[1] is within 2 of 193
12
PASS buffer[2] is within 2 of 14
13
PASS buffer[0] is within 2 of 194
14
PASS buffer[1] is within 2 of 193
15
PASS buffer[2] is within 2 of 14
16
PASS buffer[0] is within 2 of 194
17
PASS buffer[1] is within 2 of 193
18
PASS buffer[2] is within 2 of 14
19
PASS buffer[0] is within 2 of 17
20
PASS buffer[1] is within 2 of 197
21
PASS buffer[2] is within 2 of 195
22
PASS buffer[0] is within 2 of 17
23
PASS buffer[1] is within 2 of 197
24
PASS buffer[2] is within 2 of 195
25
PASS buffer[0] is within 2 of 17
26
PASS buffer[1] is within 2 of 197
27
PASS buffer[2] is within 2 of 195
28
PASS buffer[0] is within 2 of 17
29
PASS buffer[1] is within 2 of 197
30
PASS buffer[2] is within 2 of 195
31
PASS buffer[0] is within 2 of 20
32
PASS buffer[1] is within 2 of 200
8
PASS buffer[1] is within 2 of 200
33
PASS buffer[2] is within 2 of 18
9
PASS buffer[2] is within 2 of 0
34
PASS buffer[0] is within 2 of 20
10
PASS buffer[0] is within 2 of 200
35
PASS buffer[1] is within 2 of 200
11
PASS buffer[1] is within 2 of 200
36
PASS buffer[2] is within 2 of 18
12
PASS buffer[2] is within 2 of 0
37
PASS buffer[0] is within 2 of 20
13
PASS buffer[0] is within 2 of 200
38
PASS buffer[1] is within 2 of 200
14
PASS buffer[1] is within 2 of 200
39
PASS buffer[2] is within 2 of 18
15
PASS buffer[2] is within 2 of 0
40
PASS buffer[0] is within 2 of 20
16
PASS buffer[0] is within 2 of 200
41
PASS buffer[1] is within 2 of 200
17
PASS buffer[1] is within 2 of 200
42
PASS buffer[2] is within 2 of 18
18
PASS buffer[2] is within 2 of 0
43
PASS buffer[0] is within 2 of 194
19
PASS buffer[0] is within 2 of 57
44
PASS buffer[1] is within 2 of 193
20
PASS buffer[1] is within 2 of 202
45
PASS buffer[2] is within 2 of 14
21
PASS buffer[2] is within 2 of 203
46
PASS buffer[0] is within 2 of 194
22
PASS buffer[0] is within 2 of 57
47
PASS buffer[1] is within 2 of 193
23
PASS buffer[1] is within 2 of 202
48
PASS buffer[2] is within 2 of 14
24
PASS buffer[2] is within 2 of 203
49
PASS buffer[0] is within 2 of 194
25
PASS buffer[0] is within 2 of 57
50
PASS buffer[1] is within 2 of 193
26
PASS buffer[1] is within 2 of 202
51
PASS buffer[2] is within 2 of 14
27
PASS buffer[2] is within 2 of 203
52
PASS buffer[0] is within 2 of 194
28
PASS buffer[0] is within 2 of 57
53
PASS buffer[1] is within 2 of 193
29
PASS buffer[1] is within 2 of 202
54
PASS buffer[2] is within 2 of 14
30
PASS buffer[2] is within 2 of 203
55
PASS buffer[0] is within 2 of 17
31
PASS buffer[0] is within 2 of 53
56
PASS buffer[1] is within 2 of 197
32
PASS buffer[1] is within 2 of 203
57
PASS buffer[2] is within 2 of 195
33
PASS buffer[2] is within 2 of 9
58
PASS buffer[0] is within 2 of 17
34
PASS buffer[0] is within 2 of 53
59
PASS buffer[1] is within 2 of 197
35
PASS buffer[1] is within 2 of 203
60
PASS buffer[2] is within 2 of 195
36
PASS buffer[2] is within 2 of 9
61
PASS buffer[0] is within 2 of 17
37
PASS buffer[0] is within 2 of 53
62
PASS buffer[1] is within 2 of 197
38
PASS buffer[1] is within 2 of 203
63
PASS buffer[2] is within 2 of 195
39
PASS buffer[2] is within 2 of 9
64
PASS buffer[0] is within 2 of 17
40
PASS buffer[0] is within 2 of 53
65
PASS buffer[1] is within 2 of 197
41
PASS buffer[1] is within 2 of 203
66
PASS buffer[2] is within 2 of 195
42
PASS buffer[2] is within 2 of 9
67
PASS buffer[0] is within 2 of 20
43
PASS buffer[0] is within 2 of 200
68
PASS buffer[1] is within 2 of 200
44
PASS buffer[1] is within 2 of 200
69
PASS buffer[2] is within 2 of 18
45
PASS buffer[2] is within 2 of 0
70
PASS buffer[0] is within 2 of 20
46
PASS buffer[0] is within 2 of 200
71
PASS buffer[1] is within 2 of 200
47
PASS buffer[1] is within 2 of 200
72
PASS buffer[2] is within 2 of 18
48
PASS buffer[2] is within 2 of 0
73
PASS buffer[0] is within 2 of 20
49
PASS buffer[0] is within 2 of 200
74
PASS buffer[1] is within 2 of 200
50
PASS buffer[1] is within 2 of 200
75
PASS buffer[2] is within 2 of 18
51
PASS buffer[2] is within 2 of 0
76
PASS buffer[0] is within 2 of 20
52
PASS buffer[0] is within 2 of 200
77
PASS buffer[1] is within 2 of 200
53
PASS buffer[1] is within 2 of 200
78
PASS buffer[2] is within 2 of 18
54
PASS buffer[2] is within 2 of 0
55
PASS buffer[0] is within 2 of 57
56
PASS buffer[1] is within 2 of 202
57
PASS buffer[2] is within 2 of 203
58
PASS buffer[0] is within 2 of 57
59
PASS buffer[1] is within 2 of 202
60
PASS buffer[2] is within 2 of 203
61
PASS buffer[0] is within 2 of 57
62
PASS buffer[1] is within 2 of 202
63
PASS buffer[2] is within 2 of 203
64
PASS buffer[0] is within 2 of 57
65
PASS buffer[1] is within 2 of 202
66
PASS buffer[2] is within 2 of 203
67
PASS buffer[0] is within 2 of 53
68
PASS buffer[1] is within 2 of 203
69
PASS buffer[2] is within 2 of 9
70
PASS buffer[0] is within 2 of 53
71
PASS buffer[1] is within 2 of 203
72
PASS buffer[2] is within 2 of 9
73
PASS buffer[0] is within 2 of 53
74
PASS buffer[1] is within 2 of 203
75
PASS buffer[2] is within 2 of 9
76
PASS buffer[0] is within 2 of 53
77
PASS buffer[1] is within 2 of 203
78
PASS buffer[2] is within 2 of 9
79
PASS successfullyParsed is true
79
PASS successfullyParsed is true
80
80
81
TEST COMPLETE
81
TEST COMPLETE
- a/LayoutTests/fast/canvas/canvas-createPattern-video-loading.html -14 / +14 lines
Lines 12-31 a/LayoutTests/fast/canvas/canvas-createPattern-video-loading.html_sec1
12
    var buffer;
12
    var buffer;
13
    var expectedResults = [
13
    var expectedResults = [
14
        // Each entry is formatted as [x, y, r, g, b].
14
        // Each entry is formatted as [x, y, r, g, b].
15
        [40, 165, 194, 193, 14], // Represents yellow north west tile.
15
        [40, 165, 200, 200, 0], // Represents yellow north west tile.
16
        [355, 165, 194, 193, 14], // Represents yellow north east tile.
16
        [355, 165, 200, 200, 0], // Represents yellow north east tile.
17
        [40, 403, 194, 193, 14], // Represents yellow south west tile.
17
        [40, 403, 200, 200, 0], // Represents yellow south west tile.
18
        [355, 403, 194, 193, 14], // Represents yellow south east tile.
18
        [355, 403, 200, 200, 0], // Represents yellow south east tile.
19
19
20
        [56, 165, 17, 197, 195], // Represents blue/cyan north west tile.
20
        [56, 165, 57, 202, 203], // Represents blue/cyan north west tile.
21
        [371, 165, 17, 197, 195], // Represents blue/cyan north east tile.
21
        [371, 165, 57, 202, 203], // Represents blue/cyan north east tile.
22
        [56, 403, 17, 197, 195], // Represents blue/cyan south west tile.
22
        [56, 403, 57, 202, 203], // Represents blue/cyan south west tile.
23
        [371, 403, 17, 197, 195], // Represents blue/cyan south east tile.
23
        [371, 403, 57, 202, 203], // Represents blue/cyan south east tile.
24
24
25
        [73, 165, 20, 200, 18], // Represents green north west tile.
25
        [73, 165, 53, 203, 9], // Represents green north west tile.
26
        [388, 165, 20, 200, 18], // Represents green north east tile.
26
        [388, 165, 53, 203, 9], // Represents green north east tile.
27
        [73, 403, 20, 200, 18], // Represents green south west tile.
27
        [73, 403, 53, 203, 9], // Represents green south west tile.
28
        [388, 403, 20, 200, 18], // Represents green south east tile.
28
        [388, 403, 53, 203, 9], // Represents green south east tile.
29
    ];
29
    ];
30
30
31
    var canvases = document.createElement("div");
31
    var canvases = document.createElement("div");
- a/LayoutTests/fast/canvas/canvas-createPattern-video-modify-expected.txt -12 / +12 lines
Lines 3-20 Tests that modifying the video used in createPattern does not affect the pattern a/LayoutTests/fast/canvas/canvas-createPattern-video-modify-expected.txt_sec1
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
4
5
5
6
PASS buffer[0] is within 2 of 194
6
PASS buffer[0] is within 2 of 200
7
PASS buffer[1] is within 2 of 193
7
PASS buffer[1] is within 2 of 200
8
PASS buffer[2] is within 2 of 14
8
PASS buffer[2] is within 2 of 0
9
PASS buffer[0] is within 2 of 194
9
PASS buffer[0] is within 2 of 200
10
PASS buffer[1] is within 2 of 193
10
PASS buffer[1] is within 2 of 200
11
PASS buffer[2] is within 2 of 14
11
PASS buffer[2] is within 2 of 0
12
PASS buffer[0] is within 2 of 194
12
PASS buffer[0] is within 2 of 200
13
PASS buffer[1] is within 2 of 193
13
PASS buffer[1] is within 2 of 200
14
PASS buffer[2] is within 2 of 14
14
PASS buffer[2] is within 2 of 0
15
PASS buffer[0] is within 2 of 194
15
PASS buffer[0] is within 2 of 200
16
PASS buffer[1] is within 2 of 193
16
PASS buffer[1] is within 2 of 200
17
PASS buffer[2] is within 2 of 14
17
PASS buffer[2] is within 2 of 0
18
PASS successfullyParsed is true
18
PASS successfullyParsed is true
19
19
20
TEST COMPLETE
20
TEST COMPLETE
- a/LayoutTests/fast/canvas/canvas-createPattern-video-modify.html -4 / +4 lines
Lines 14-23 a/LayoutTests/fast/canvas/canvas-createPattern-video-modify.html_sec1
14
    var modified = false;
14
    var modified = false;
15
    var expectedResults = [
15
    var expectedResults = [
16
        // Each entry is formatted as [x, y, r, g, b].
16
        // Each entry is formatted as [x, y, r, g, b].
17
        [40, 165, 194, 193, 14], // Represents yellow north west tile.
17
        [40, 165, 200, 200, 0], // Represents yellow north west tile.
18
        [355, 165, 194, 193, 14], // Represents yellow north east tile.
18
        [355, 165, 200, 200, 0], // Represents yellow north east tile.
19
        [40, 403, 194, 193, 14], // Represents yellow south west tile.
19
        [40, 403, 200, 200, 0], // Represents yellow south west tile.
20
        [355, 403, 194, 193, 14], // Represents yellow south east tile.
20
        [355, 403, 200, 200, 0], // Represents yellow south east tile.
21
    ];
21
    ];
22
22
23
    var video = document.createElement("video");
23
    var video = document.createElement("video");
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html -8 / +22 lines
Lines 9-27 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html_sec1
9
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
9
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
10
<body>
10
<body>
11
<script>
11
<script>
12
function testCanvasDisplayingPattern(canvas, width, height)
12
function testCanvasDisplayingPattern(canvas, width, height, sourceIsVideo)
13
{
13
{
14
    var tolerance = 10; // for creating ImageBitmap from a video, the tolerance needs to be high
14
    var tolerance = 1;
15
    const check = (x, y, r, g, b, a) =>
15
    let topLeft = [255, 0, 0, 255];
16
    let topRight = [0, 255, 0, 255];
17
    let bottomLeft = [0, 0, 255, 255];
18
    let bottomRight = [0, 0, 0, 255];
19
    if (sourceIsVideo) {
20
        // The source video uses colors in the Rec.601 color space whose
21
        // values are close to full red, full green, full blue, and black,
22
        // but when converted to sRGB, are somewhat different.
23
        topLeft = [247, 37, 0, 255];
24
        topRight = [63, 251, 0, 255];
25
        bottomLeft = [28, 35, 255, 255];
26
        bottomRight = [5, 0, 2, 255];
27
    }
28
    const check = (x, y, [r, g, b, a]) =>
16
        _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance);
29
        _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance);
17
    check(1 * width / 4, 1 * height / 4, 255,0,0,255);
30
    check(1 * width / 4, 1 * height / 4, topLeft);
18
    check(3 * width / 4, 1 * height / 4, 0,255,0,255);
31
    check(3 * width / 4, 1 * height / 4, topRight);
19
    check(1 * width / 4, 3 * height / 4, 0,0,255,255);
32
    check(1 * width / 4, 3 * height / 4, bottomLeft);
20
    check(3 * width / 4, 3 * height / 4, 0,0,0,255);
33
    check(3 * width / 4, 3 * height / 4, bottomRight);
21
}
34
}
22
35
23
function testDrawImageBitmap(source, args = [], { resizeWidth = 20, resizeHeight = 20 } = {})
36
function testDrawImageBitmap(source, args = [], { resizeWidth = 20, resizeHeight = 20 } = {})
24
{
37
{
38
    let sourceIsVideo = source instanceof HTMLVideoElement;
25
    var canvas = document.createElement("canvas");
39
    var canvas = document.createElement("canvas");
26
    canvas.width = resizeWidth;
40
    canvas.width = resizeWidth;
27
    canvas.height = resizeHeight;
41
    canvas.height = resizeHeight;
Lines 30-36 function testDrawImageBitmap(source, args = [], { resizeWidth = 20, resizeHeight a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html_sec2
30
        assert_equals(imageBitmap.width, resizeWidth);
44
        assert_equals(imageBitmap.width, resizeWidth);
31
        assert_equals(imageBitmap.height, resizeHeight);
45
        assert_equals(imageBitmap.height, resizeHeight);
32
        ctx.drawImage(imageBitmap, 0, 0);
46
        ctx.drawImage(imageBitmap, 0, 0);
33
        testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight);
47
        testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, sourceIsVideo);
34
    });
48
    });
35
}
49
}
36
50
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html -14 / +25 lines
Lines 9-34 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html_sec1
9
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
9
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
10
<body>
10
<body>
11
<script>
11
<script>
12
function testCanvasDisplayingPattern(canvas, width, height, flipped)
12
function testCanvasDisplayingPattern(canvas, width, height, sourceIsVideo, flipped)
13
{
13
{
14
    var tolerance = 10; // for creating ImageBitmap from a video, the tolerance needs to be high
14
    var tolerance = 1;
15
    const check = (x, y, r, g, b, a) =>
15
    let topLeft = [255, 0, 0, 255];
16
        _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance);
16
    let topRight = [0, 255, 0, 255];
17
    let bottomLeft = [0, 0, 255, 255];
18
    let bottomRight = [0, 0, 0, 255];
19
    if (sourceIsVideo) {
20
        // The source video uses colors in the Rec.601 color space whose
21
        // values are close to full red, full green, full blue, and black,
22
        // but when converted to sRGB, are somewhat different.
23
        topLeft = [247, 37, 0, 255];
24
        topRight = [63, 251, 0, 255];
25
        bottomLeft = [28, 35, 255, 255];
26
        bottomRight = [5, 0, 2, 255];
27
    }
17
    if (flipped) {
28
    if (flipped) {
18
        check(1 * width / 4, 3 * height / 4, 255,0,0,255);
29
        [topLeft, bottomLeft] = [bottomLeft, topLeft];
19
        check(3 * width / 4, 3 * height / 4, 0,255,0,255);
30
        [topRight, bottomRight] = [bottomRight, topRight];
20
        check(1 * width / 4, 1 * height / 4, 0,0,255,255);
21
        check(3 * width / 4, 1 * height / 4, 0,0,0,255);
22
    } else {
23
        check(1 * width / 4, 1 * height / 4, 255,0,0,255);
24
        check(3 * width / 4, 1 * height / 4, 0,255,0,255);
25
        check(1 * width / 4, 3 * height / 4, 0,0,255,255);
26
        check(3 * width / 4, 3 * height / 4, 0,0,0,255);
27
    }
31
    }
32
    const check = (x, y, [r, g, b, a]) =>
33
        _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance);
34
    check(1 * width / 4, 1 * height / 4, topLeft);
35
    check(3 * width / 4, 1 * height / 4, topRight);
36
    check(1 * width / 4, 3 * height / 4, bottomLeft);
37
    check(3 * width / 4, 3 * height / 4, bottomRight);
28
}
38
}
29
39
30
function testDrawImageBitmap(source, args = [], flipped, { resizeWidth = 20, resizeHeight = 20 } = {})
40
function testDrawImageBitmap(source, args = [], flipped, { resizeWidth = 20, resizeHeight = 20 } = {})
31
{
41
{
42
    let sourceIsVideo = source instanceof HTMLVideoElement;
32
    var canvas = document.createElement("canvas");
43
    var canvas = document.createElement("canvas");
33
    canvas.width = resizeWidth;
44
    canvas.width = resizeWidth;
34
    canvas.height = resizeHeight;
45
    canvas.height = resizeHeight;
Lines 37-43 function testDrawImageBitmap(source, args = [], flipped, { resizeWidth = 20, res a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html_sec2
37
        assert_equals(imageBitmap.width, resizeWidth);
48
        assert_equals(imageBitmap.width, resizeWidth);
38
        assert_equals(imageBitmap.height, resizeHeight);
49
        assert_equals(imageBitmap.height, resizeHeight);
39
        ctx.drawImage(imageBitmap, 0, 0);
50
        ctx.drawImage(imageBitmap, 0, 0);
40
        testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, flipped);
51
        testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, sourceIsVideo, flipped);
41
    });
52
    });
42
}
53
}
43
54
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video-expected.txt +34 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video-expected.txt_sec1
1
2
PASS sRGB-FF0100, Context srgb, ImageData srgb, cropSource=false
3
PASS sRGB-FF0100, Context srgb, ImageData srgb, cropSource=true
4
PASS sRGB-FF0100, Context srgb, ImageData display-p3, cropSource=false
5
PASS sRGB-FF0100, Context srgb, ImageData display-p3, cropSource=true
6
PASS sRGB-FF0100, Context display-p3, ImageData srgb, cropSource=false
7
PASS sRGB-FF0100, Context display-p3, ImageData srgb, cropSource=true
8
PASS sRGB-FF0100, Context display-p3, ImageData display-p3, cropSource=false
9
PASS sRGB-FF0100, Context display-p3, ImageData display-p3, cropSource=true
10
PASS sRGB-BB0000, Context srgb, ImageData srgb, cropSource=false
11
PASS sRGB-BB0000, Context srgb, ImageData srgb, cropSource=true
12
PASS sRGB-BB0000, Context srgb, ImageData display-p3, cropSource=false
13
PASS sRGB-BB0000, Context srgb, ImageData display-p3, cropSource=true
14
PASS sRGB-BB0000, Context display-p3, ImageData srgb, cropSource=false
15
PASS sRGB-BB0000, Context display-p3, ImageData srgb, cropSource=true
16
PASS sRGB-BB0000, Context display-p3, ImageData display-p3, cropSource=false
17
PASS sRGB-BB0000, Context display-p3, ImageData display-p3, cropSource=true
18
PASS Rec2020-3FF000000, Context srgb, ImageData srgb, cropSource=false
19
PASS Rec2020-3FF000000, Context srgb, ImageData srgb, cropSource=true
20
PASS Rec2020-3FF000000, Context srgb, ImageData display-p3, cropSource=false
21
PASS Rec2020-3FF000000, Context srgb, ImageData display-p3, cropSource=true
22
PASS Rec2020-3FF000000, Context display-p3, ImageData srgb, cropSource=false
23
PASS Rec2020-3FF000000, Context display-p3, ImageData srgb, cropSource=true
24
PASS Rec2020-3FF000000, Context display-p3, ImageData display-p3, cropSource=false
25
PASS Rec2020-3FF000000, Context display-p3, ImageData display-p3, cropSource=true
26
PASS Rec2020-222000000, Context srgb, ImageData srgb, cropSource=false
27
PASS Rec2020-222000000, Context srgb, ImageData srgb, cropSource=true
28
PASS Rec2020-222000000, Context srgb, ImageData display-p3, cropSource=false
29
PASS Rec2020-222000000, Context srgb, ImageData display-p3, cropSource=true
30
PASS Rec2020-222000000, Context display-p3, ImageData srgb, cropSource=false
31
PASS Rec2020-222000000, Context display-p3, ImageData srgb, cropSource=true
32
PASS Rec2020-222000000, Context display-p3, ImageData display-p3, cropSource=false
33
PASS Rec2020-222000000, Context display-p3, ImageData display-p3, cropSource=true
34
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html +55 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html_sec1
1
<!DOCTYPE HTML>
2
<script src="/resources/testharness.js"></script>
3
<script src="/resources/testharnessreport.js"></script>
4
<script src="canvas-display-p3.js"></script>
5
<body>
6
<script>
7
// Test that drawing ImageBitmaps with different video source color profiles
8
// into sRGB and Display P3 canvases works, by reading pixels with
9
// getImageData() as sRGB and Display P3 values.
10
for (let [filenameBase, expectedPixels] of Object.entries(videoTests)) {
11
    for (let contextColorSpace of ["srgb", "display-p3"]) {
12
        for (let imageDataColorSpace of ["srgb", "display-p3"]) {
13
            for (let cropSource of [false, true]) {
14
                async_test(function(t) {
15
                    let video = document.createElement("video");
16
                    video.onloadeddata = t.step_func(function() {
17
18
                        let canvas = document.createElement("canvas");
19
                        canvas.width = 2;
20
                        canvas.height = 2;
21
22
                        let ctx = canvas.getContext("2d", { colorSpace: contextColorSpace });
23
24
                        let imageBitmapPromise;
25
                        if (cropSource)
26
                            imageBitmapPromise = createImageBitmap(video, 1, 1, 1, 1);
27
                        else
28
                            imageBitmapPromise = createImageBitmap(video);
29
30
                        imageBitmapPromise.then(t.step_func_done(function(imageBitmap) {
31
                            video.remove();
32
                            ctx.drawImage(imageBitmap, 0, 0);
33
34
                            let imageData = ctx.getImageData(0, 0, 1, 1, { colorSpace: imageDataColorSpace });
35
36
                            let expected = expectedPixels[`${contextColorSpace} ${imageDataColorSpace}`];
37
                            assert_true(pixelsApproximatelyEqual(imageData.data, expected), `Actual pixel value ${[...imageData.data]} is approximately equal to ${expected}.`);
38
                        }), t.step_func(function(error) {
39
                            video.remove();
40
                            throw error;
41
                        }));
42
                    });
43
                    for (let format of ["mp4", "webm"]) {
44
                        let source = document.createElement("source");
45
                        source.src = `resources/${filenameBase}.${format}`;
46
                        source.type = `video/${format}`;
47
                        video.append(source);
48
                    }
49
                    document.body.append(video);
50
                }, `${filenameBase}, Context ${contextColorSpace}, ImageData ${imageDataColorSpace}, cropSource=${cropSource}`);
51
            }
52
        }
53
    }
54
}
55
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-expected.txt -210 lines
Lines 1-210 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-expected.txt_sec1
1
2
PASS sRGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
3
PASS sRGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
4
PASS sRGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
5
PASS sRGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
6
PASS sRGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
7
PASS sRGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
8
PASS sRGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
9
PASS sRGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
10
PASS sRGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
11
PASS sRGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
12
PASS sRGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
13
PASS sRGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
14
PASS sRGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
15
PASS sRGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
16
PASS sRGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
17
PASS sRGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
18
PASS sRGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
19
PASS sRGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
20
PASS sRGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
21
PASS sRGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
22
PASS sRGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
23
PASS sRGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
24
PASS sRGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
25
PASS sRGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
26
PASS sRGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
27
PASS sRGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
28
PASS sRGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
29
PASS sRGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
30
PASS sRGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
31
PASS sRGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
32
PASS sRGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
33
PASS sRGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
34
PASS Display-P3-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
35
PASS Display-P3-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
36
PASS Display-P3-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
37
PASS Display-P3-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
38
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
39
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
40
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
41
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
42
PASS Display-P3-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
43
PASS Display-P3-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
44
PASS Display-P3-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
45
PASS Display-P3-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
46
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
47
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
48
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
49
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
50
PASS Display-P3-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
51
PASS Display-P3-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
52
PASS Display-P3-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
53
PASS Display-P3-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
54
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
55
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
56
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
57
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
58
PASS Display-P3-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
59
PASS Display-P3-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
60
PASS Display-P3-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
61
PASS Display-P3-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
62
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
63
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
64
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
65
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
66
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
67
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
68
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
69
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
70
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
71
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
72
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
73
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
74
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
75
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
76
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
77
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
78
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
79
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
80
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
81
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
82
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
83
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
84
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
85
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
86
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
87
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
88
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
89
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
90
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
91
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
92
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
93
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
94
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
95
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
96
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
97
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
98
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData srgb, scaleImage=false
99
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData srgb, scaleImage=true
100
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData display-p3, scaleImage=false
101
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData display-p3, scaleImage=true
102
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData srgb, scaleImage=false
103
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData srgb, scaleImage=true
104
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData display-p3, scaleImage=false
105
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData display-p3, scaleImage=true
106
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData srgb, scaleImage=false
107
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData srgb, scaleImage=true
108
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData display-p3, scaleImage=false
109
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData display-p3, scaleImage=true
110
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData srgb, scaleImage=false
111
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData srgb, scaleImage=true
112
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData display-p3, scaleImage=false
113
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData display-p3, scaleImage=true
114
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
115
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
116
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
117
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
118
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
119
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
120
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
121
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
122
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
123
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
124
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
125
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
126
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
127
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
128
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
129
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
130
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
131
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
132
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
133
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
134
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
135
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
136
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
137
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
138
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
139
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
140
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
141
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
142
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
143
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
144
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
145
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
146
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
147
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
148
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
149
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
150
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
151
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
152
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
153
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
154
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
155
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
156
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
157
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
158
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
159
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
160
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
161
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
162
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
163
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
164
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
165
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
166
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
167
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
168
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
169
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
170
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
171
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
172
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
173
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
174
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
175
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
176
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
177
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
178
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
179
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
180
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
181
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
182
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
183
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
184
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
185
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
186
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
187
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
188
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
189
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
190
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
191
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
192
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
193
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
194
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
195
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
196
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
197
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
198
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
199
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
200
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
201
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
202
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
203
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
204
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
205
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
206
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
207
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
208
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
209
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
210
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video-expected.txt +34 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video-expected.txt_sec1
1
2
PASS sRGB-FF0100, Context srgb, ImageData srgb, scaleImage=false
3
PASS sRGB-FF0100, Context srgb, ImageData srgb, scaleImage=true
4
PASS sRGB-FF0100, Context srgb, ImageData display-p3, scaleImage=false
5
PASS sRGB-FF0100, Context srgb, ImageData display-p3, scaleImage=true
6
PASS sRGB-FF0100, Context display-p3, ImageData srgb, scaleImage=false
7
PASS sRGB-FF0100, Context display-p3, ImageData srgb, scaleImage=true
8
PASS sRGB-FF0100, Context display-p3, ImageData display-p3, scaleImage=false
9
PASS sRGB-FF0100, Context display-p3, ImageData display-p3, scaleImage=true
10
PASS sRGB-BB0000, Context srgb, ImageData srgb, scaleImage=false
11
PASS sRGB-BB0000, Context srgb, ImageData srgb, scaleImage=true
12
PASS sRGB-BB0000, Context srgb, ImageData display-p3, scaleImage=false
13
PASS sRGB-BB0000, Context srgb, ImageData display-p3, scaleImage=true
14
PASS sRGB-BB0000, Context display-p3, ImageData srgb, scaleImage=false
15
PASS sRGB-BB0000, Context display-p3, ImageData srgb, scaleImage=true
16
PASS sRGB-BB0000, Context display-p3, ImageData display-p3, scaleImage=false
17
PASS sRGB-BB0000, Context display-p3, ImageData display-p3, scaleImage=true
18
PASS Rec2020-3FF000000, Context srgb, ImageData srgb, scaleImage=false
19
PASS Rec2020-3FF000000, Context srgb, ImageData srgb, scaleImage=true
20
PASS Rec2020-3FF000000, Context srgb, ImageData display-p3, scaleImage=false
21
PASS Rec2020-3FF000000, Context srgb, ImageData display-p3, scaleImage=true
22
PASS Rec2020-3FF000000, Context display-p3, ImageData srgb, scaleImage=false
23
PASS Rec2020-3FF000000, Context display-p3, ImageData srgb, scaleImage=true
24
PASS Rec2020-3FF000000, Context display-p3, ImageData display-p3, scaleImage=false
25
PASS Rec2020-3FF000000, Context display-p3, ImageData display-p3, scaleImage=true
26
PASS Rec2020-222000000, Context srgb, ImageData srgb, scaleImage=false
27
PASS Rec2020-222000000, Context srgb, ImageData srgb, scaleImage=true
28
PASS Rec2020-222000000, Context srgb, ImageData display-p3, scaleImage=false
29
PASS Rec2020-222000000, Context srgb, ImageData display-p3, scaleImage=true
30
PASS Rec2020-222000000, Context display-p3, ImageData srgb, scaleImage=false
31
PASS Rec2020-222000000, Context display-p3, ImageData srgb, scaleImage=true
32
PASS Rec2020-222000000, Context display-p3, ImageData display-p3, scaleImage=false
33
PASS Rec2020-222000000, Context display-p3, ImageData display-p3, scaleImage=true
34
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html +46 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html_sec1
1
<!DOCTYPE HTML>
2
<script src="/resources/testharness.js"></script>
3
<script src="/resources/testharnessreport.js"></script>
4
<script src="canvas-display-p3.js"></script>
5
<body>
6
<script>
7
// Test that drawing videos with different color spaces into sRGB and Display P3
8
// canvases works, by reading pixels with getImageData() as sRGB and Display P3
9
// values.
10
for (let [filenameBase, expectedPixels] of Object.entries(videoTests)) {
11
    for (let contextColorSpace of ["srgb", "display-p3"]) {
12
        for (let imageDataColorSpace of ["srgb", "display-p3"]) {
13
            for (let scaleImage of [false, true]) {
14
                async_test(function(t) {
15
                    let video = document.createElement("video");
16
                    video.onloadeddata = t.step_func_done(function() {
17
18
                        let canvas = document.createElement("canvas");
19
                        canvas.width = 2;
20
                        canvas.height = 2;
21
22
                        let ctx = canvas.getContext("2d", { colorSpace: contextColorSpace });
23
                        if (scaleImage)
24
                            ctx.drawImage(video, 0, 0, 10, 10);
25
                        else
26
                            ctx.drawImage(video, 0, 0);
27
                        video.remove();
28
29
                        let imageData = ctx.getImageData(0, 0, 1, 1, { colorSpace: imageDataColorSpace });
30
31
                        let expected = expectedPixels[`${contextColorSpace} ${imageDataColorSpace}`];
32
                        assert_true(pixelsApproximatelyEqual(imageData.data, expected), `Actual pixel value ${[...imageData.data]} is approximately equal to ${expected}.`);
33
                    });
34
                    for (let format of ["mp4", "webm"]) {
35
                        let source = document.createElement("source");
36
                        source.src = `resources/${filenameBase}.${format}`;
37
                        source.type = `video/${format}`;
38
                        video.append(source);
39
                    }
40
                    document.body.append(video);
41
                }, `${filenameBase}, Context ${contextColorSpace}, ImageData ${imageDataColorSpace}, scaleImage=${scaleImage}`);
42
            }
43
        }
44
    }
45
}
46
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html -41 lines
Lines 1-41 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html_sec1
1
<!DOCTYPE HTML>
2
<script src="/resources/testharness.js"></script>
3
<script src="/resources/testharnessreport.js"></script>
4
<script src="canvas-display-p3.js"></script>
5
<script>
6
// Test that drawing images with different bit depths and color profiles into
7
// sRGB and Display P3 canvases works, by reading pixels with getImageData()
8
// as sRGB and Display P3 values.
9
for (let [filename, expectedPixels] of Object.entries(imageTests)) {
10
    for (let contextColorSpace of ["srgb", "display-p3"]) {
11
        for (let imageDataColorSpace of ["srgb", "display-p3"]) {
12
            for (let scaleImage of [false, true]) {
13
                async_test(function(t) {
14
                    let image = new Image();
15
                    image.onload = t.step_func_done(function() {
16
17
                        let canvas = document.createElement("canvas");
18
                        canvas.width = 2;
19
                        canvas.height = 2;
20
21
                        let ctx = canvas.getContext("2d", { colorSpace: contextColorSpace });
22
                        if (scaleImage)
23
                            ctx.drawImage(image, 0, 0, 10, 10);
24
                        else
25
                            ctx.drawImage(image, 0, 0);
26
27
                        let imageData = ctx.getImageData(0, 0, 1, 1, { colorSpace: imageDataColorSpace });
28
29
                        let expected = expectedPixels[`${contextColorSpace} ${imageDataColorSpace}`];
30
                        assert_true(pixelsApproximatelyEqual(imageData.data, expected), `Actual pixel value ${[...imageData.data]} is approximately equal to ${expected}.`);
31
32
                        t.done();
33
34
                    });
35
                    image.src = `resources/${filename}`;
36
                }, `${filename}, Context ${contextColorSpace}, ImageData ${imageDataColorSpace}, scaleImage=${scaleImage}`);
37
            }
38
        }
39
    }
40
}
41
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https-expected.txt +242 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https-expected.txt_sec1
1
2
PASS sRGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
3
PASS sRGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
4
PASS sRGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
5
PASS sRGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
6
PASS sRGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
7
PASS sRGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
8
PASS sRGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
9
PASS sRGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
10
PASS sRGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
11
PASS sRGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
12
PASS sRGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
13
PASS sRGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
14
PASS sRGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
15
PASS sRGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
16
PASS sRGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
17
PASS sRGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
18
PASS sRGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
19
PASS sRGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
20
PASS sRGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
21
PASS sRGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
22
PASS sRGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
23
PASS sRGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
24
PASS sRGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
25
PASS sRGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
26
PASS sRGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
27
PASS sRGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
28
PASS sRGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
29
PASS sRGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
30
PASS sRGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
31
PASS sRGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
32
PASS sRGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
33
PASS sRGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
34
PASS Display-P3-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
35
PASS Display-P3-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
36
PASS Display-P3-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
37
PASS Display-P3-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
38
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
39
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
40
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
41
PASS Display-P3-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
42
PASS Display-P3-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
43
PASS Display-P3-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
44
PASS Display-P3-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
45
PASS Display-P3-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
46
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
47
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
48
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
49
PASS Display-P3-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
50
PASS Display-P3-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
51
PASS Display-P3-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
52
PASS Display-P3-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
53
PASS Display-P3-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
54
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
55
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
56
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
57
PASS Display-P3-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
58
PASS Display-P3-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
59
PASS Display-P3-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
60
PASS Display-P3-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
61
PASS Display-P3-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
62
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
63
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
64
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
65
PASS Display-P3-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
66
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=false
67
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData srgb, scaleImage=true
68
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
69
PASS Adobe-RGB-FF0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
70
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
71
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
72
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
73
PASS Adobe-RGB-FF0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
74
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=false
75
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData srgb, scaleImage=true
76
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
77
PASS Adobe-RGB-FF0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
78
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
79
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
80
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
81
PASS Adobe-RGB-FF0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
82
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=false
83
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData srgb, scaleImage=true
84
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=false
85
PASS Adobe-RGB-BB0000FF.png, Context srgb, ImageData display-p3, scaleImage=true
86
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=false
87
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData srgb, scaleImage=true
88
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=false
89
PASS Adobe-RGB-BB0000FF.png, Context display-p3, ImageData display-p3, scaleImage=true
90
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=false
91
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData srgb, scaleImage=true
92
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=false
93
PASS Adobe-RGB-BB0000CC.png, Context srgb, ImageData display-p3, scaleImage=true
94
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=false
95
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData srgb, scaleImage=true
96
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=false
97
PASS Adobe-RGB-BB0000CC.png, Context display-p3, ImageData display-p3, scaleImage=true
98
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData srgb, scaleImage=false
99
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData srgb, scaleImage=true
100
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData display-p3, scaleImage=false
101
PASS Generic-CMYK-FF000000.jpg, Context srgb, ImageData display-p3, scaleImage=true
102
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData srgb, scaleImage=false
103
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData srgb, scaleImage=true
104
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData display-p3, scaleImage=false
105
PASS Generic-CMYK-FF000000.jpg, Context display-p3, ImageData display-p3, scaleImage=true
106
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData srgb, scaleImage=false
107
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData srgb, scaleImage=true
108
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData display-p3, scaleImage=false
109
PASS Generic-CMYK-BE000000.jpg, Context srgb, ImageData display-p3, scaleImage=true
110
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData srgb, scaleImage=false
111
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData srgb, scaleImage=true
112
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData display-p3, scaleImage=false
113
PASS Generic-CMYK-BE000000.jpg, Context display-p3, ImageData display-p3, scaleImage=true
114
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
115
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
116
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
117
PASS sRGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
118
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
119
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
120
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
121
PASS sRGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
122
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
123
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
124
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
125
PASS sRGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
126
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
127
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
128
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
129
PASS sRGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
130
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
131
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
132
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
133
PASS sRGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
134
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
135
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
136
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
137
PASS sRGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
138
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
139
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
140
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
141
PASS sRGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
142
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
143
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
144
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
145
PASS sRGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
146
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
147
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
148
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
149
PASS Display-P3-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
150
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
151
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
152
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
153
PASS Display-P3-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
154
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
155
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
156
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
157
PASS Display-P3-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
158
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
159
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
160
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
161
PASS Display-P3-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
162
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
163
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
164
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
165
PASS Display-P3-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
166
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
167
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
168
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
169
PASS Display-P3-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
170
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
171
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
172
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
173
PASS Display-P3-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
174
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
175
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
176
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
177
PASS Display-P3-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
178
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
179
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
180
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
181
PASS Adobe-RGB-FFFF00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
182
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
183
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
184
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
185
PASS Adobe-RGB-FFFF00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
186
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
187
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
188
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
189
PASS Adobe-RGB-FFFF00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
190
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
191
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
192
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
193
PASS Adobe-RGB-FFFF00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
194
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=false
195
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData srgb, scaleImage=true
196
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=false
197
PASS Adobe-RGB-BBBC00000000FFFF.png, Context srgb, ImageData display-p3, scaleImage=true
198
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=false
199
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData srgb, scaleImage=true
200
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=false
201
PASS Adobe-RGB-BBBC00000000FFFF.png, Context display-p3, ImageData display-p3, scaleImage=true
202
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=false
203
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData srgb, scaleImage=true
204
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=false
205
PASS Adobe-RGB-BBBC00000000CCCC.png, Context srgb, ImageData display-p3, scaleImage=true
206
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=false
207
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData srgb, scaleImage=true
208
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=false
209
PASS Adobe-RGB-BBBC00000000CCCC.png, Context display-p3, ImageData display-p3, scaleImage=true
210
PASS sRGB-FF0000.svg, Context srgb, ImageData srgb, scaleImage=false
211
PASS sRGB-FF0000.svg, Context srgb, ImageData srgb, scaleImage=true
212
PASS sRGB-FF0000.svg, Context srgb, ImageData display-p3, scaleImage=false
213
PASS sRGB-FF0000.svg, Context srgb, ImageData display-p3, scaleImage=true
214
PASS sRGB-FF0000.svg, Context display-p3, ImageData srgb, scaleImage=false
215
PASS sRGB-FF0000.svg, Context display-p3, ImageData srgb, scaleImage=true
216
PASS sRGB-FF0000.svg, Context display-p3, ImageData display-p3, scaleImage=false
217
PASS sRGB-FF0000.svg, Context display-p3, ImageData display-p3, scaleImage=true
218
PASS sRGB-BB0000.svg, Context srgb, ImageData srgb, scaleImage=false
219
PASS sRGB-BB0000.svg, Context srgb, ImageData srgb, scaleImage=true
220
PASS sRGB-BB0000.svg, Context srgb, ImageData display-p3, scaleImage=false
221
PASS sRGB-BB0000.svg, Context srgb, ImageData display-p3, scaleImage=true
222
PASS sRGB-BB0000.svg, Context display-p3, ImageData srgb, scaleImage=false
223
PASS sRGB-BB0000.svg, Context display-p3, ImageData srgb, scaleImage=true
224
PASS sRGB-BB0000.svg, Context display-p3, ImageData display-p3, scaleImage=false
225
PASS sRGB-BB0000.svg, Context display-p3, ImageData display-p3, scaleImage=true
226
PASS Display-P3-1-0-0.svg, Context srgb, ImageData srgb, scaleImage=false
227
PASS Display-P3-1-0-0.svg, Context srgb, ImageData srgb, scaleImage=true
228
PASS Display-P3-1-0-0.svg, Context srgb, ImageData display-p3, scaleImage=false
229
PASS Display-P3-1-0-0.svg, Context srgb, ImageData display-p3, scaleImage=true
230
PASS Display-P3-1-0-0.svg, Context display-p3, ImageData srgb, scaleImage=false
231
PASS Display-P3-1-0-0.svg, Context display-p3, ImageData srgb, scaleImage=true
232
PASS Display-P3-1-0-0.svg, Context display-p3, ImageData display-p3, scaleImage=false
233
PASS Display-P3-1-0-0.svg, Context display-p3, ImageData display-p3, scaleImage=true
234
PASS Display-P3-0.7333-0-0.svg, Context srgb, ImageData srgb, scaleImage=false
235
PASS Display-P3-0.7333-0-0.svg, Context srgb, ImageData srgb, scaleImage=true
236
PASS Display-P3-0.7333-0-0.svg, Context srgb, ImageData display-p3, scaleImage=false
237
PASS Display-P3-0.7333-0-0.svg, Context srgb, ImageData display-p3, scaleImage=true
238
PASS Display-P3-0.7333-0-0.svg, Context display-p3, ImageData srgb, scaleImage=false
239
PASS Display-P3-0.7333-0-0.svg, Context display-p3, ImageData srgb, scaleImage=true
240
PASS Display-P3-0.7333-0-0.svg, Context display-p3, ImageData display-p3, scaleImage=false
241
PASS Display-P3-0.7333-0-0.svg, Context display-p3, ImageData display-p3, scaleImage=true
242
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html +41 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html_sec1
1
<!DOCTYPE HTML>
2
<script src="/resources/testharness.js"></script>
3
<script src="/resources/testharnessreport.js"></script>
4
<script src="canvas-display-p3.js"></script>
5
<script>
6
// Test that drawing images with different bit depths and color profiles into
7
// sRGB and Display P3 canvases works, by reading pixels with getImageData()
8
// as sRGB and Display P3 values.
9
for (let [filename, expectedPixels] of Object.entries({...imageTests, ...svgImageTests})) {
10
    for (let contextColorSpace of ["srgb", "display-p3"]) {
11
        for (let imageDataColorSpace of ["srgb", "display-p3"]) {
12
            for (let scaleImage of [false, true]) {
13
                async_test(function(t) {
14
                    let image = new Image();
15
                    image.onload = t.step_func_done(function() {
16
17
                        let canvas = document.createElement("canvas");
18
                        canvas.width = 2;
19
                        canvas.height = 2;
20
21
                        let ctx = canvas.getContext("2d", { colorSpace: contextColorSpace });
22
                        if (scaleImage)
23
                            ctx.drawImage(image, 0, 0, 10, 10);
24
                        else
25
                            ctx.drawImage(image, 0, 0);
26
27
                        let imageData = ctx.getImageData(0, 0, 1, 1, { colorSpace: imageDataColorSpace });
28
29
                        let expected = expectedPixels[`${contextColorSpace} ${imageDataColorSpace}`];
30
                        assert_true(pixelsApproximatelyEqual(imageData.data, expected), `Actual pixel value ${[...imageData.data]} is approximately equal to ${expected}.`);
31
32
                        t.done();
33
34
                    });
35
                    image.src = `resources/${filename}`;
36
                }, `${filename}, Context ${contextColorSpace}, ImageData ${imageDataColorSpace}, scaleImage=${scaleImage}`);
37
            }
38
        }
39
    }
40
}
41
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js -2 / +85 lines
Lines 1-4 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js_sec1
1
// Each image:
1
// Each PNG:
2
//  * is 2x2 and has a single color
2
//  * is 2x2 and has a single color
3
//  * has a filename that indicates its contents:
3
//  * has a filename that indicates its contents:
4
//      <embedded-profile>-<8-or-16-bit-color-value>.png
4
//      <embedded-profile>-<8-or-16-bit-color-value>.png
Lines 177-182 const imageTests = { a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js_sec2
177
    },
177
    },
178
};
178
};
179
179
180
const svgImageTests = {
181
    // SVG source images
182
183
    "sRGB-FF0000.svg": {
184
        "srgb srgb": [255, 0, 0, 255],
185
        "srgb display-p3": [234, 51, 35, 255],
186
        "display-p3 srgb": [255, 0, 0, 255],
187
        "display-p3 display-p3": [234, 51, 35, 255],
188
    },
189
    "sRGB-BB0000.svg": {
190
        "srgb srgb": [187, 0, 0, 255],
191
        "srgb display-p3": [171, 35, 23, 255],
192
        "display-p3 srgb": [187, 1, 0, 255],
193
        "display-p3 display-p3": [171, 35, 23, 255],
194
    },
195
196
    "Display-P3-1-0-0.svg": {
197
        "srgb srgb": [255, 0, 0, 255],
198
        "srgb display-p3": [234, 51, 35, 255],
199
        "display-p3 srgb": [255, 0, 0, 255],
200
        "display-p3 display-p3": [255, 0, 0, 255],
201
    },
202
    "Display-P3-0.7333-0-0.svg": {
203
        "srgb srgb": [205, 0, 0, 255],
204
        "srgb display-p3": [188, 39, 26, 255],
205
        "display-p3 srgb": [205, 0, 0, 255],
206
        "display-p3 display-p3": [187, 0, 0, 255],
207
    },
208
};
209
210
// Each video:
211
//  * is 300x200 and has a single color
212
//  * has a filename base that indicates its contents:
213
//
214
//      <color-space>-<8-or-10-bit-color-value>
215
//
216
//  * was generated using commands like:
217
//
218
//      W=300 H=200 Y=3F Cb=66 Cr=F0 ; \
219
//        perl -e "print pack('c', 0x$Y) x ($W * $H), pack('c', 0x$Cb) x ($W * $H / 4), pack('c', 0x$Cr) x ($W * $H / 4)" | \
220
//        ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${W}x$H -r 25 -i - -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc iec61966_2_1 sRGB-FF0100.webm
221
//
222
//      W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \
223
//        perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \
224
//        ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -c:v libx265 -vtag hvc1 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.mp4
225
//
226
//      W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \
227
//        perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \
228
//        ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -vcodec libvpx-vp9 -profile:v 2 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.webm
229
//
230
//    where the Y'CbCr values were computed using https://jdashg.github.io/misc/colors/from-coeffs.html.
231
const videoTests = {
232
    // Rec.709 Y'CbCr (0x3F, 0x66, 0xF0) = sRGB (0xFF, 0x01, 0x00)
233
    "sRGB-FF0100": {
234
        "srgb srgb": [255, 1, 0, 255],
235
        "srgb display-p3": [234, 51, 35, 255],
236
        "display-p3 srgb": [255, 0, 0, 255],
237
        "display-p3 display-p3": [234, 51, 35, 255],
238
    },
239
    // Rec.709 Y'CbCr (0x32, 0x6D, 0xD2) = sRGB (0xBB, 0x00, 0x00)
240
    "sRGB-BB0000": {
241
        "srgb srgb": [187, 0, 0, 255],
242
        "srgb display-p3": [171, 35, 23, 255],
243
        "display-p3 srgb": [187, 1, 0, 255],
244
        "display-p3 display-p3": [171, 35, 23, 255],
245
    },
246
247
    // 10 bit Rec.2020 Y'CbCr (0x126, 0x183, 0x3C0) = Rec.2020 (0x3FF, 0x000, 0x000)
248
    "Rec2020-3FF000000": {
249
        "srgb srgb": [255, 0, 0, 255],
250
        "srgb display-p3": [234, 51, 35, 255],
251
        "display-p3 srgb": [255, 0, 0, 255],
252
        "display-p3 display-p3": [255, 0, 9, 255],
253
    },
254
    // 10 bit Rec.2020 Y'CbCr (0x0BB, 0x1BD, 0x2EF) = Rec.2020 (0x222, 0x000, 0x000)
255
    "Rec2020-222000000": {
256
        "srgb srgb": [186, 0, 0, 255],
257
        "srgb display-p3": [170, 34, 23, 255],
258
        "display-p3 srgb": [186, 0, 0, 255],
259
        "display-p3 display-p3": [169, 0, 3, 255],
260
    },
261
};
262
180
const fromSRGBToDisplayP3 = {
263
const fromSRGBToDisplayP3 = {
181
    "255,0,0,255": [234, 51, 35, 255],
264
    "255,0,0,255": [234, 51, 35, 255],
182
    "255,0,0,204": [234, 51, 35, 204],
265
    "255,0,0,204": [234, 51, 35, 204],
Lines 193-199 const fromDisplayP3ToSRGB = { a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js_sec3
193
276
194
function pixelsApproximatelyEqual(p1, p2) {
277
function pixelsApproximatelyEqual(p1, p2) {
195
    for (let i = 0; i < 4; ++i) {
278
    for (let i = 0; i < 4; ++i) {
196
        if (Math.abs(p1[i] - p2[i]) > 2)
279
        if (Math.abs(p1[i] - p2[i]) > 3)
197
            return false;
280
            return false;
198
    }
281
    }
199
    return true;
282
    return true;
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-0.7333-0-0.svg +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-0.7333-0-0.svg_sec1
1
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2">
2
  <rect width="2" height="2" style="fill: color(display-p3 0.7333 0 0);"/>
3
</svg>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-1-0-0.svg +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Display-P3-1-0-0.svg_sec1
1
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2">
2
  <rect width="2" height="2" style="fill: color(display-p3 1 0 0);"/>
3
</svg>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.svg +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.svg_sec1
1
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2">
2
  <rect width="2" height="2" style="fill: #BB0000;"/>
3
</svg>
- a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0000.svg +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0000.svg_sec1
1
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2">
2
  <rect width="2" height="2" style="fill: #FF0000;"/>
3
</svg>
- a/LayoutTests/media/video-canvas-createPattern-expected.txt -48 / +48 lines
Lines 1-56 a/LayoutTests/media/video-canvas-createPattern-expected.txt_sec1
1
1
2
EVENT(canplaythrough)
2
EVENT(canplaythrough)
3
EVENT(seeked)
3
EVENT(seeked)
4
Saw close enough to (194, 193, 14) at (40, 165) OK
4
Saw close enough to (200, 200, 0) at (40, 165) OK
5
Saw close enough to (194, 193, 14) at (355, 165) OK
5
Saw close enough to (200, 200, 0) at (355, 165) OK
6
Saw close enough to (194, 193, 14) at (40, 403) OK
6
Saw close enough to (200, 200, 0) at (40, 403) OK
7
Saw close enough to (194, 193, 14) at (355, 403) OK
7
Saw close enough to (200, 200, 0) at (355, 403) OK
8
Saw close enough to (17, 197, 195) at (56, 165) OK
8
Saw close enough to (57, 202, 203) at (56, 165) OK
9
Saw close enough to (17, 197, 195) at (371, 165) OK
9
Saw close enough to (57, 202, 203) at (371, 165) OK
10
Saw close enough to (17, 197, 195) at (56, 403) OK
10
Saw close enough to (57, 202, 203) at (56, 403) OK
11
Saw close enough to (17, 197, 195) at (371, 403) OK
11
Saw close enough to (57, 202, 203) at (371, 403) OK
12
Saw close enough to (20, 200, 18) at (73, 165) OK
12
Saw close enough to (53, 203, 9) at (73, 165) OK
13
Saw close enough to (20, 200, 18) at (388, 165) OK
13
Saw close enough to (53, 203, 9) at (388, 165) OK
14
Saw close enough to (20, 200, 18) at (73, 403) OK
14
Saw close enough to (53, 203, 9) at (73, 403) OK
15
Saw close enough to (20, 200, 18) at (388, 403) OK
15
Saw close enough to (53, 203, 9) at (388, 403) OK
16
EVENT(seeked)
16
EVENT(seeked)
17
Saw close enough to (194, 193, 14) at (40, 165) OK
17
Saw close enough to (200, 200, 0) at (40, 165) OK
18
Saw close enough to (194, 193, 14) at (355, 165) OK
18
Saw close enough to (200, 200, 0) at (355, 165) OK
19
Saw close enough to (194, 193, 14) at (40, 403) OK
19
Saw close enough to (200, 200, 0) at (40, 403) OK
20
Saw close enough to (194, 193, 14) at (355, 403) OK
20
Saw close enough to (200, 200, 0) at (355, 403) OK
21
Saw close enough to (17, 197, 195) at (56, 165) OK
21
Saw close enough to (57, 202, 203) at (56, 165) OK
22
Saw close enough to (17, 197, 195) at (371, 165) OK
22
Saw close enough to (57, 202, 203) at (371, 165) OK
23
Saw close enough to (17, 197, 195) at (56, 403) OK
23
Saw close enough to (57, 202, 203) at (56, 403) OK
24
Saw close enough to (17, 197, 195) at (371, 403) OK
24
Saw close enough to (57, 202, 203) at (371, 403) OK
25
Saw close enough to (20, 200, 18) at (73, 165) OK
25
Saw close enough to (53, 203, 9) at (73, 165) OK
26
Saw close enough to (20, 200, 18) at (388, 165) OK
26
Saw close enough to (53, 203, 9) at (388, 165) OK
27
Saw close enough to (20, 200, 18) at (73, 403) OK
27
Saw close enough to (53, 203, 9) at (73, 403) OK
28
Saw close enough to (20, 200, 18) at (388, 403) OK
28
Saw close enough to (53, 203, 9) at (388, 403) OK
29
EVENT(seeked)
29
EVENT(seeked)
30
Saw close enough to (194, 193, 14) at (40, 165) OK
30
Saw close enough to (200, 200, 0) at (40, 165) OK
31
Saw close enough to (194, 193, 14) at (355, 165) OK
31
Saw close enough to (200, 200, 0) at (355, 165) OK
32
Saw close enough to (194, 193, 14) at (40, 403) OK
32
Saw close enough to (200, 200, 0) at (40, 403) OK
33
Saw close enough to (194, 193, 14) at (355, 403) OK
33
Saw close enough to (200, 200, 0) at (355, 403) OK
34
Saw close enough to (17, 197, 195) at (56, 165) OK
34
Saw close enough to (57, 202, 203) at (56, 165) OK
35
Saw close enough to (17, 197, 195) at (371, 165) OK
35
Saw close enough to (57, 202, 203) at (371, 165) OK
36
Saw close enough to (17, 197, 195) at (56, 403) OK
36
Saw close enough to (57, 202, 203) at (56, 403) OK
37
Saw close enough to (17, 197, 195) at (371, 403) OK
37
Saw close enough to (57, 202, 203) at (371, 403) OK
38
Saw close enough to (20, 200, 18) at (73, 165) OK
38
Saw close enough to (53, 203, 9) at (73, 165) OK
39
Saw close enough to (20, 200, 18) at (388, 165) OK
39
Saw close enough to (53, 203, 9) at (388, 165) OK
40
Saw close enough to (20, 200, 18) at (73, 403) OK
40
Saw close enough to (53, 203, 9) at (73, 403) OK
41
Saw close enough to (20, 200, 18) at (388, 403) OK
41
Saw close enough to (53, 203, 9) at (388, 403) OK
42
EVENT(seeked)
42
EVENT(seeked)
43
Saw close enough to (194, 193, 14) at (40, 165) OK
43
Saw close enough to (200, 200, 0) at (40, 165) OK
44
Saw close enough to (194, 193, 14) at (355, 165) OK
44
Saw close enough to (200, 200, 0) at (355, 165) OK
45
Saw close enough to (194, 193, 14) at (40, 403) OK
45
Saw close enough to (200, 200, 0) at (40, 403) OK
46
Saw close enough to (194, 193, 14) at (355, 403) OK
46
Saw close enough to (200, 200, 0) at (355, 403) OK
47
Saw close enough to (17, 197, 195) at (56, 165) OK
47
Saw close enough to (57, 202, 203) at (56, 165) OK
48
Saw close enough to (17, 197, 195) at (371, 165) OK
48
Saw close enough to (57, 202, 203) at (371, 165) OK
49
Saw close enough to (17, 197, 195) at (56, 403) OK
49
Saw close enough to (57, 202, 203) at (56, 403) OK
50
Saw close enough to (17, 197, 195) at (371, 403) OK
50
Saw close enough to (57, 202, 203) at (371, 403) OK
51
Saw close enough to (20, 200, 18) at (73, 165) OK
51
Saw close enough to (53, 203, 9) at (73, 165) OK
52
Saw close enough to (20, 200, 18) at (388, 165) OK
52
Saw close enough to (53, 203, 9) at (388, 165) OK
53
Saw close enough to (20, 200, 18) at (73, 403) OK
53
Saw close enough to (53, 203, 9) at (73, 403) OK
54
Saw close enough to (20, 200, 18) at (388, 403) OK
54
Saw close enough to (53, 203, 9) at (388, 403) OK
55
END OF TEST
55
END OF TEST
56
56
- a/LayoutTests/media/video-canvas-createPattern.html -12 / +12 lines
Lines 10-29 a/LayoutTests/media/video-canvas-createPattern.html_sec1
10
10
11
            var expectedResults = [
11
            var expectedResults = [
12
                // Each entry is formatted as [x, y, r, g, b].
12
                // Each entry is formatted as [x, y, r, g, b].
13
                [40, 165, 194, 193, 14], // Represents yellow north west tile.
13
                [40, 165, 200, 200, 0], // Represents yellow north west tile.
14
                [355, 165, 194, 193, 14], // Represents yellow north east tile.
14
                [355, 165, 200, 200, 0], // Represents yellow north east tile.
15
                [40, 403, 194, 193, 14], // Represents yellow south west tile.
15
                [40, 403, 200, 200, 0], // Represents yellow south west tile.
16
                [355, 403, 194, 193, 14], // Represents yellow south east tile.
16
                [355, 403, 200, 200, 0], // Represents yellow south east tile.
17
17
18
                [56, 165, 17, 197, 195], // Represents blue/cyan north west tile.
18
                [56, 165, 57, 202, 203], // Represents blue/cyan north west tile.
19
                [371, 165, 17, 197, 195], // Represents blue/cyan north east tile.
19
                [371, 165, 57, 202, 203], // Represents blue/cyan north east tile.
20
                [56, 403, 17, 197, 195], // Represents blue/cyan south west tile.
20
                [56, 403, 57, 202, 203], // Represents blue/cyan south west tile.
21
                [371, 403, 17, 197, 195], // Represents blue/cyan south east tile.
21
                [371, 403, 57, 202, 203], // Represents blue/cyan south east tile.
22
22
23
                [73, 165, 20, 200, 18], // Represents green north west tile.
23
                [73, 165, 53, 203, 9], // Represents green north west tile.
24
                [388, 165, 20, 200, 18], // Represents green north east tile.
24
                [388, 165, 53, 203, 9], // Represents green north east tile.
25
                [73, 403, 20, 200, 18], // Represents green south west tile.
25
                [73, 403, 53, 203, 9], // Represents green south west tile.
26
                [388, 403, 20, 200, 18], // Represents green south east tile.
26
                [388, 403, 53, 203, 9], // Represents green south east tile.
27
            ]
27
            ]
28
28
29
            if (window.testRunner) {
29
            if (window.testRunner) {
- a/LayoutTests/media/video-canvas-drawing-output-expected.txt -12 / +12 lines
Lines 1-20 a/LayoutTests/media/video-canvas-drawing-output-expected.txt_sec1
1
1
2
EVENT(canplaythrough)
2
EVENT(canplaythrough)
3
EVENT(seeked)
3
EVENT(seeked)
4
Saw close enough to (194, 193, 14) at (40, 165) OK
4
Saw close enough to (200, 200, 0) at (40, 165) OK
5
Saw close enough to (17, 197, 195) at (56, 165) OK
5
Saw close enough to (57, 202, 203) at (56, 165) OK
6
Saw close enough to (20, 200, 18) at (73, 165) OK
6
Saw close enough to (53, 203, 9) at (73, 165) OK
7
EVENT(seeked)
7
EVENT(seeked)
8
Saw close enough to (194, 193, 14) at (40, 165) OK
8
Saw close enough to (200, 200, 0) at (40, 165) OK
9
Saw close enough to (17, 197, 195) at (56, 165) OK
9
Saw close enough to (57, 202, 203) at (56, 165) OK
10
Saw close enough to (20, 200, 18) at (73, 165) OK
10
Saw close enough to (53, 203, 9) at (73, 165) OK
11
EVENT(seeked)
11
EVENT(seeked)
12
Saw close enough to (194, 193, 14) at (40, 165) OK
12
Saw close enough to (200, 200, 0) at (40, 165) OK
13
Saw close enough to (17, 197, 195) at (56, 165) OK
13
Saw close enough to (57, 202, 203) at (56, 165) OK
14
Saw close enough to (20, 200, 18) at (73, 165) OK
14
Saw close enough to (53, 203, 9) at (73, 165) OK
15
EVENT(seeked)
15
EVENT(seeked)
16
Saw close enough to (194, 193, 14) at (40, 165) OK
16
Saw close enough to (200, 200, 0) at (40, 165) OK
17
Saw close enough to (17, 197, 195) at (56, 165) OK
17
Saw close enough to (57, 202, 203) at (56, 165) OK
18
Saw close enough to (20, 200, 18) at (73, 165) OK
18
Saw close enough to (53, 203, 9) at (73, 165) OK
19
END OF TEST
19
END OF TEST
20
20
- a/LayoutTests/media/video-canvas-drawing-output.html -3 / +3 lines
Lines 8-16 a/LayoutTests/media/video-canvas-drawing-output.html_sec1
8
8
9
            var expectedResults = [
9
            var expectedResults = [
10
                // [x, y, r, g, b]
10
                // [x, y, r, g, b]
11
                [40, 165, 194, 193, 14], // yellow
11
                [40, 165, 200, 200, 0], // yellow
12
                [56, 165, 17, 197, 195], // blue/cyan
12
                [56, 165, 57, 202, 203], // blue/cyan
13
                [73, 165, 20, 200, 18], // green
13
                [73, 165, 53, 203, 9], // green
14
            ];
14
            ];
15
15
16
            if (window.testRunner) {
16
            if (window.testRunner) {
- a/LayoutTests/media/video-orientation-canvas-expected.txt -3 / +3 lines
Lines 1-6 a/LayoutTests/media/video-orientation-canvas-expected.txt_sec1
1
1
2
EXPECTED (context.getImageData(88, 115, 1, 1).data == [208,0,0,255] with tolerance 5 OK
2
EXPECTED (context.getImageData(88, 115, 1, 1).data == [208,30,0,255] with tolerance 5 OK
3
EXPECTED (context.getImageData(237, 88, 1, 1).data == [208,0,0,255] with tolerance 5 OK
3
EXPECTED (context.getImageData(237, 88, 1, 1).data == [208,30,0,255] with tolerance 5 OK
4
EXPECTED (context.getImageData(200, 237, 1, 1).data == [208,0,0,255] with tolerance 5 OK
4
EXPECTED (context.getImageData(200, 237, 1, 1).data == [208,30,0,255] with tolerance 5 OK
5
END OF TEST
5
END OF TEST
6
6
- a/LayoutTests/media/video-orientation-canvas.html -2 / +2 lines
Lines 4-10 a/LayoutTests/media/video-orientation-canvas.html_sec1
4
    <title>video-orientation-canvas</title>
4
    <title>video-orientation-canvas</title>
5
    <script src="video-test.js"></script>
5
    <script src="video-test.js"></script>
6
    <script>
6
    <script>
7
        let redColor = new Uint8ClampedArray([208, 0, 0, 255]);
7
        let redColor = new Uint8ClampedArray([208, 30, 0, 255]);
8
        var context;
8
        var context;
9
9
10
        function arraysAreApproximatelyEqual(arrayString, expected, tolerance) {
10
        function arraysAreApproximatelyEqual(arrayString, expected, tolerance) {
Lines 74-77 a/LayoutTests/media/video-orientation-canvas.html_sec2
74
    <canvas id=canvas2></canvas>
74
    <canvas id=canvas2></canvas>
75
    <canvas id=canvas3></canvas>
75
    <canvas id=canvas3></canvas>
76
</body>
76
</body>
77
</html>
77
</html>
- a/LayoutTests/platform/glib/TestExpectations -2 lines
Lines 232-239 media/media-controller-time-constant.html [ Pass ] a/LayoutTests/platform/glib/TestExpectations_sec1
232
media/media-controller-time.html [ Pass ]
232
media/media-controller-time.html [ Pass ]
233
media/media-controller-unpause.html [ Pass ]
233
media/media-controller-unpause.html [ Pass ]
234
media/mediacapabilities/mediacapabilities-types.html [ Pass ]
234
media/mediacapabilities/mediacapabilities-types.html [ Pass ]
235
media/video-canvas-createPattern.html [ Pass ]
236
media/video-canvas-drawing-output.html [ Pass ]
237
media/video-controller-currentTime-rate.html [ Pass ]
235
media/video-controller-currentTime-rate.html [ Pass ]
238
webaudio/codec-tests/aac/vbr-128kbps-44khz.html [ Pass ]
236
webaudio/codec-tests/aac/vbr-128kbps-44khz.html [ Pass ]
239
webaudio/codec-tests/mp3/128kbps-44khz.html [ Pass ]
237
webaudio/codec-tests/mp3/128kbps-44khz.html [ Pass ]
- a/LayoutTests/platform/ios-14/TestExpectations -1 / +3 lines
Lines 65-77 http/tests/app-privacy-report/ [ Skip ] a/LayoutTests/platform/ios-14/TestExpectations_sec1
65
# display-p3 canvas and ImageData are iOS 15+.
65
# display-p3 canvas and ImageData are iOS 15+.
66
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
66
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
67
fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
67
fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
68
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html [ Failure ]
68
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html [ Failure ]
69
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Failure ]
69
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Failure ]
70
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Failure ]
70
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Failure ]
71
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Failure ]
71
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Failure ]
72
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Failure ]
72
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Failure ]
73
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ]
73
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ]
74
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ]
74
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ]
75
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Failure ]
76
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Failure ]
75
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ]
77
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ]
76
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ]
78
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ]
77
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Failure ]
79
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Failure ]
- a/LayoutTests/platform/ios-device/TestExpectations -2 lines
Lines 99-106 js/stringimpl-to-jsstring-on-large-strings-3.html [ Crash ] a/LayoutTests/platform/ios-device/TestExpectations_sec1
99
99
100
loader/go-back-to-different-window-size.html [ Crash ]
100
loader/go-back-to-different-window-size.html [ Crash ]
101
101
102
media/video-canvas-createPattern.html [ Failure ]
103
media/video-canvas-drawing-output.html [ Failure ]
104
media/video-load-preload-metadata.html [ Failure ]
102
media/video-load-preload-metadata.html [ Failure ]
105
media/video-played-collapse.html [ Failure ]
103
media/video-played-collapse.html [ Failure ]
106
media/video-played-reset.html [ Failure ]
104
media/video-played-reset.html [ Failure ]
- a/LayoutTests/platform/ios/TestExpectations -1 / +3 lines
Lines 3477-3489 webkit.org/b/228176 fast/text/variable-system-font-2.html [ Pass ] a/LayoutTests/platform/ios/TestExpectations_sec1
3477
# display-p3 canvas and ImageData are Cocoa only for now.
3477
# display-p3 canvas and ImageData are Cocoa only for now.
3478
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Pass ]
3478
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Pass ]
3479
fast/canvas/canvas-color-space-display-p3.html [ Pass ]
3479
fast/canvas/canvas-color-space-display-p3.html [ Pass ]
3480
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html [ Pass ]
3480
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html [ Pass ]
3481
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Pass ]
3481
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Pass ]
3482
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Pass ]
3482
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Pass ]
3483
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Pass ]
3483
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Pass ]
3484
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Pass ]
3484
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Pass ]
3485
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ]
3485
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ]
3486
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ]
3486
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ]
3487
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Pass ]
3488
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Pass ]
3487
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ]
3489
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ]
3488
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ]
3490
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ]
3489
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Pass ]
3491
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Pass ]
- a/LayoutTests/platform/mac-bigsur/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt +21 lines
Line 0 a/LayoutTests/platform/mac-bigsur/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 247,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported
- a/LayoutTests/platform/mac-bigsur/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt +21 lines
Line 0 a/LayoutTests/platform/mac-bigsur/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html?webglVersion=2
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 247,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported
- a/LayoutTests/platform/mac-catalina/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt +21 lines
Line 0 a/LayoutTests/platform/mac-catalina/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 247,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported
- a/LayoutTests/platform/mac-catalina/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt +21 lines
Line 0 a/LayoutTests/platform/mac-catalina/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html?webglVersion=2
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 247,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported
- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt -1 / +1 lines
Lines 8-14 PASS createImageBitmap from an HTMLVideoElement from a data URL imageOrientation a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt_sec1
8
PASS createImageBitmap from a bitmap HTMLImageElement imageOrientation: "none", and drawImage on the created ImageBitmap
8
PASS createImageBitmap from a bitmap HTMLImageElement imageOrientation: "none", and drawImage on the created ImageBitmap
9
PASS createImageBitmap from a bitmap HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap
9
PASS createImageBitmap from a bitmap HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap
10
PASS createImageBitmap from a vector HTMLImageElement imageOrientation: "none", and drawImage on the created ImageBitmap
10
PASS createImageBitmap from a vector HTMLImageElement imageOrientation: "none", and drawImage on the created ImageBitmap
11
FAIL createImageBitmap from a vector HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 0
11
FAIL createImageBitmap from a vector HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 1 but got 255
12
FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
12
FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
13
FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
13
FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
14
FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
14
FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
- a/LayoutTests/platform/mac-wk2/TestExpectations -1 lines
Lines 1223-1229 webkit.org/b/179796 http/tests/cache/disk-cache/disk-cache-validation-back-navig a/LayoutTests/platform/mac-wk2/TestExpectations_sec1
1223
[ arm64 ] imported/w3c/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html [ Failure ]
1223
[ arm64 ] imported/w3c/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html [ Failure ]
1224
[ arm64 ] imported/w3c/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html [ Failure ]
1224
[ arm64 ] imported/w3c/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html [ Failure ]
1225
[ arm64 ] inspector/canvas/memory.html [ Failure ]
1225
[ arm64 ] inspector/canvas/memory.html [ Failure ]
1226
[ arm64 ] media/video-canvas-createPattern.html [ Failure ]
1227
1226
1228
webkit.org/b/229671 [ BigSur+ Debug arm64 ] imported/w3c/web-platform-tests/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-auto.html [ Pass Crash ]
1227
webkit.org/b/229671 [ BigSur+ Debug arm64 ] imported/w3c/web-platform-tests/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-auto.html [ Pass Crash ]
1229
1228
- a/LayoutTests/platform/mac/TestExpectations -4 / +3 lines
Lines 1928-1936 webkit.org/b/230411 http/tests/media/hls/video-controller-getStartDate.html [ Pa a/LayoutTests/platform/mac/TestExpectations_sec1
1928
1928
1929
webkit.org/b/227891 http/tests/appcache/fail-on-update.html [ Pass Timeout DumpJSConsoleLogInStdErr ]
1929
webkit.org/b/227891 http/tests/appcache/fail-on-update.html [ Pass Timeout DumpJSConsoleLogInStdErr ]
1930
1930
1931
# rdar://66660680 (REGRESSION (20A2327a-20A2348b): media/video-canvas-createPattern.html is failing)
1932
[ BigSur+ ] media/video-canvas-createPattern.html [ Failure ]
1933
1934
# Remove this once <rdar://problem/66734187> hits the bots
1931
# Remove this once <rdar://problem/66734187> hits the bots
1935
[ BigSur+ ] fast/text/locale-shaping.html [ Pass ImageOnlyFailure ]
1932
[ BigSur+ ] fast/text/locale-shaping.html [ Pass ImageOnlyFailure ]
1936
1933
Lines 2352-2364 webkit.org/b/230116 imported/w3c/web-platform-tests/webrtc-extensions/transfer-d a/LayoutTests/platform/mac/TestExpectations_sec2
2352
# display-p3 canvas and ImageData are Cocoa only for now.
2349
# display-p3 canvas and ImageData are Cocoa only for now.
2353
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3-ImageData.html [ Pass ]
2350
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3-ImageData.html [ Pass ]
2354
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3.html [ Pass ]
2351
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3.html [ Pass ]
2355
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.html [ Pass ]
2352
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage.https.html [ Pass ]
2356
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Pass ]
2353
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-Blob.html [ Pass ]
2357
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Pass ]
2354
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageBitmap.html [ Pass ]
2358
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Pass ]
2355
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-ImageData.html [ Pass ]
2359
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Pass ]
2356
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-canvas.html [ Pass ]
2360
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ]
2357
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ]
2361
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ]
2358
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ]
2359
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Pass ]
2360
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Pass ]
2362
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ]
2361
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ]
2363
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ]
2362
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ]
2364
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Pass ]
2363
[ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-settings.html [ Pass ]
- a/LayoutTests/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt -1 / +18 lines
Lines 1-4 a/LayoutTests/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html
4
[ PASS ] All tests passed
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 248,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported
- a/LayoutTests/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt -1 / +18 lines
Lines 1-4 a/LayoutTests/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt_sec1
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
1
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
2
2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html?webglVersion=2
3
Test: ../../../../resources/webgl_test_files/conformance/textures/misc/texture-corner-case-videos.html?webglVersion=2
4
[ PASS ] All tests passed
4
5
[ 1: PASS ] shouldBe 0,255,0
6
[ 2: PASS ] shouldBe 255,0,0
7
[ 3: PASS ] getError was expected value: NO_ERROR : should be no errors
8
[ 4: PASS ] shouldBe 255,0,0
9
[ 5: PASS ] shouldBe 0,255,0
10
[ 6: PASS ] getError was expected value: NO_ERROR : should be no errors
11
[ 7: PASS ] shouldBe 0,255,0
12
[ 8: PASS ] shouldBe 255,0,0
13
[ 9: PASS ] getError was expected value: NO_ERROR : should be no errors
14
[ 10: PASS ] shouldBe 255,0,0
15
[ 11: PASS ] shouldBe 0,255,0
16
[ 12: PASS ] getError was expected value: NO_ERROR : should be no errors
17
[ 13: FAIL ] shouldBe 0,255,0 at (4, 24) expected: 0,255,0 was 63,251,0
18
[ 14: FAIL ] shouldBe 255,0,0 at (4, 4) expected: 255,0,0 was 248,36,0
19
[ 15: PASS ] getError was expected value: NO_ERROR : should be no errors
20
[ 16: PASS ] successfullyParsed is true
21
[ FAIL ] 2 failures reported

Return to Bug 229025