| Differences between
and this patch
- Source/WebCore/ChangeLog +139 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2021-05-15  Sam Weinig  <weinig@apple.com>
2
3
        Add support for creating/accessing/setting non-sRGB ImageData via canvas
4
        https://bugs.webkit.org/show_bug.cgi?id=225841
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Test: fast/canvas/canvas-color-space-display-p3-ImageData.html
9
10
        Add support for accessing non-sRGB (only DisplayP3 for now due
11
        to the specification, but the support is general) pixel data in
12
        HTML canvas.
13
14
        Updates ImageData constructors and CanvasImageData operations to 
15
        take optional ImageDataSettings dictionaries, which contain an 
16
        optional color space (otherwise defaulting back to sRGB). 
17
18
        * CMakeLists.txt:
19
        * DerivedSources-input.xcfilelist:
20
        * DerivedSources-output.xcfilelist:
21
        * DerivedSources.make:
22
        * Sources.txt:
23
        * WebCore.xcodeproj/project.pbxproj:
24
        * html/ImageDataSettings.h: Added.
25
        * html/ImageDataSettings.idl: Added.
26
        Add new ImageDataSettings.idl and related files.
27
28
        * bindings/js/SerializedScriptValue.cpp:
29
        (WebCore::CloneDeserializer::readImageBitmap):
30
        Fixes FIXME and uses PixelBuffer directly rather than allocating
31
        an unnecessary ImageData. This was done now since the relevent
32
        ImageData constructor has gone away.
33
34
        * html/ImageData.cpp:
35
        (WebCore::computeDataSize):
36
        (WebCore::ImageData::computeColorSpace):
37
        (WebCore::ImageData::create):
38
        (WebCore::ImageData::createUninitialized):
39
        (WebCore::ImageData::ImageData):
40
        (WebCore::ImageData::pixelBuffer const):
41
        (WebCore::ImageData::dataSize): Deleted.
42
        (WebCore::ImageData::deepClone const): Deleted.
43
        * html/ImageData.h:
44
        (WebCore::ImageData::size const):
45
        (WebCore::ImageData::width const):
46
        (WebCore::ImageData::height const):
47
        (WebCore::ImageData::data const):
48
        (WebCore::ImageData::colorSpace const):
49
        (WebCore::ImageData::pixelBuffer const): Deleted.
50
51
        - Reworked ImageData to no longer store a PixelBuffer, which has
52
          extraneous information in it, but rather to store just what it
53
          needs IntSize, Ref<JSC::Uint8ClampedArray>, and now PredefinedColorSpace.
54
        - Updates create functions for new optional ImageDataSettings.
55
        - Adds createUninitialized which follows spec language for ImageData creation
56
          and is used by CanvasRenderingContext2D to create ImageData objects of with
57
          the right color spaces, allowing for fallback to the canvas' own color space
58
          when no ImageDataSettings color space is provided. It is uninitialized and
59
          therefore requires the client to initialize the data to allow for support for
60
          no alpha support in the future, which requires a non-zero initialization pattern.
61
62
        * html/ImageData.idl:
63
        Add optional ImageDataSettings parameters and the new colorSpace attribute.
64
65
        * html/canvas/CanvasImageData.idl:
66
        Add optional ImageDataSettings parameters.
67
68
        * html/canvas/CanvasRenderingContext2DBase.h:
69
        * html/canvas/CanvasRenderingContext2DBase.cpp:
70
        (WebCore::initializeEmptyImageData):
71
        Add helper to initialize the ImageData buffer. Right now it always calls
72
        zeroFill(), but in the future it will need to do more.
73
        
74
        (WebCore::CanvasRenderingContext2DBase::createImageData const):
75
        Update to account for this function being able to throw an exception (when 
76
        out of memory) and use the new createUninitialized/initializeEmptyImageData
77
        to create a correctly color spaced ImageData.
78
79
        (WebCore::CanvasRenderingContext2DBase::createImageData const):
80
        Update for new optional ImageDataSettings and use the new createUninitialized
81
        initializeEmptyImageData to create a correctly color spaced ImageData.
82
83
        (WebCore::CanvasRenderingContext2DBase::getImageData const):
84
        Moves parameter checks to the begining to match the spec, and uses new 
85
        createUninitialized/initializeEmptyImageData to create a correctly color 
86
        spaced ImageData. Also, use the ImageData's color space when getting
87
        the pixel buffer to actually return the right data!
88
89
        * html/canvas/PredefinedColorSpace.cpp:
90
        (WebCore::toPredefinedColorSpace):
91
        * html/canvas/PredefinedColorSpace.h:
92
        Add conversion function from DestinationColorSpace to PredefinedColorSpace.
93
        Since DestinationColorSpace is a superset of PredefinedColorSpace, this can
94
        fail, so this conversion returns an Optional.
95
96
        * inspector/InspectorCanvas.cpp:
97
        * inspector/InspectorCanvasCallTracer.cpp:
98
        * inspector/InspectorCanvasCallTracer.h:
99
        Stub out inspector support for ImageDataSettings.
100
101
        * platform/graphics/ImageBufferBackend.cpp:
102
        (WebCore::ImageBufferBackend::getPixelBuffer const):
103
        Use the ImageBuffer's actual color space as the source color space
104
        rather than hard coding sRGB. This allows the color space conversion
105
        to take place. Also remove some unnecessary temporary variables.
106
107
        (WebCore::ImageBufferBackend::putPixelBuffer):
108
        Use the ImageBuffer's actual color space as the destination color space
109
        rather than hard coding sRGB. This allows the color space conversion
110
        to take place. Also remove some unnecessary temporary variables.
111
112
        * platform/graphics/PixelBuffer.cpp:
113
        (WebCore::PixelBuffer::tryCreate):
114
        (WebCore::PixelBuffer::PixelBuffer):
115
        * platform/graphics/PixelBuffer.h:
116
        (WebCore::PixelBuffer::takeData):
117
        Add a few helpers to allow creationg to/from PixelBuffer
118
        a bit easier.
119
120
        * platform/graphics/PixelBufferConversion.cpp:
121
        (WebCore::convertImagePixelsAccelerated):
122
        Fix incorrect assertion. We want to assert that there is no error, not that
123
        there is one.
124
125
        * platform/graphics/filters/FilterEffect.cpp:
126
        (WebCore::FilterEffect::convertImageBufferToColorSpace):
127
        (WebCore::FilterEffect::copyUnmultipliedResult):
128
        (WebCore::FilterEffect::copyPremultipliedResult):
129
        (WebCore::FilterEffect::createUnmultipliedImageResult):
130
        (WebCore::FilterEffect::createPremultipliedImageResult):
131
        Stop hard coding SRGB for PixelBuffer color spaces and use the appropriate
132
        color space for the task. We still do color space conversion through ImageBuffer
133
        so we should come back and simplify code here to not always require that.
134
135
        * testing/Internals.cpp:
136
        (WebCore::Internals::videoSampleAvailable):
137
        (WebCore::Internals::loadArtworkImage):
138
        Update to specify a color space to maintain existing behavior.
139
1
2021-05-15  Alan Bujtas  <zalan@apple.com>
140
2021-05-15  Alan Bujtas  <zalan@apple.com>
2
141
3
        [LFC] Move table wrapper quirks to its own class
142
        [LFC] Move table wrapper quirks to its own class
- Source/WebCore/CMakeLists.txt +1 lines
Lines 1017-1022 set(WebCore_NON_SVG_IDL_FILES Source/WebCore/CMakeLists.txt_sec1
1017
    html/ImageBitmap.idl
1017
    html/ImageBitmap.idl
1018
    html/ImageBitmapOptions.idl
1018
    html/ImageBitmapOptions.idl
1019
    html/ImageData.idl
1019
    html/ImageData.idl
1020
    html/ImageDataSettings.idl
1020
    html/MediaController.idl
1021
    html/MediaController.idl
1021
    html/MediaEncryptedEvent.idl
1022
    html/MediaEncryptedEvent.idl
1022
    html/MediaError.idl
1023
    html/MediaError.idl
- Source/WebCore/DerivedSources-input.xcfilelist +1 lines
Lines 1036-1041 $(PROJECT_DIR)/html/HTMLVideoElement.idl Source/WebCore/DerivedSources-input.xcfilelist_sec1
1036
$(PROJECT_DIR)/html/ImageBitmap.idl
1036
$(PROJECT_DIR)/html/ImageBitmap.idl
1037
$(PROJECT_DIR)/html/ImageBitmapOptions.idl
1037
$(PROJECT_DIR)/html/ImageBitmapOptions.idl
1038
$(PROJECT_DIR)/html/ImageData.idl
1038
$(PROJECT_DIR)/html/ImageData.idl
1039
$(PROJECT_DIR)/html/ImageDataSettings.idl
1039
$(PROJECT_DIR)/html/MediaController.idl
1040
$(PROJECT_DIR)/html/MediaController.idl
1040
$(PROJECT_DIR)/html/MediaEncryptedEvent.idl
1041
$(PROJECT_DIR)/html/MediaEncryptedEvent.idl
1041
$(PROJECT_DIR)/html/MediaError.idl
1042
$(PROJECT_DIR)/html/MediaError.idl
- Source/WebCore/DerivedSources-output.xcfilelist +2 lines
Lines 1180-1185 $(BUILT_PRODUCTS_DIR)/DerivedSources/Web Source/WebCore/DerivedSources-output.xcfilelist_sec1
1180
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageBitmapRenderingContextSettings.h
1180
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageBitmapRenderingContextSettings.h
1181
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageData.cpp
1181
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageData.cpp
1182
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageData.h
1182
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageData.h
1183
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageDataSettings.cpp
1184
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageDataSettings.h
1183
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.cpp
1185
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.cpp
1184
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.h
1186
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.h
1185
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInnerHTML.cpp
1187
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInnerHTML.cpp
- Source/WebCore/DerivedSources.make +1 lines
Lines 890-895 JS_BINDING_IDLS := \ Source/WebCore/DerivedSources.make_sec1
890
    $(WebCore)/html/ImageBitmap.idl \
890
    $(WebCore)/html/ImageBitmap.idl \
891
    $(WebCore)/html/ImageBitmapOptions.idl \
891
    $(WebCore)/html/ImageBitmapOptions.idl \
892
    $(WebCore)/html/ImageData.idl \
892
    $(WebCore)/html/ImageData.idl \
893
    $(WebCore)/html/ImageDataSettings.idl \
893
    $(WebCore)/html/MediaController.idl \
894
    $(WebCore)/html/MediaController.idl \
894
    $(WebCore)/html/MediaEncryptedEvent.idl \
895
    $(WebCore)/html/MediaEncryptedEvent.idl \
895
    $(WebCore)/html/MediaError.idl \
896
    $(WebCore)/html/MediaError.idl \
- Source/WebCore/Sources.txt +1 lines
Lines 3207-3212 JSImageBitmapOptions.cpp Source/WebCore/Sources.txt_sec1
3207
JSImageBitmapRenderingContext.cpp
3207
JSImageBitmapRenderingContext.cpp
3208
JSImageBitmapRenderingContextSettings.cpp
3208
JSImageBitmapRenderingContextSettings.cpp
3209
JSImageData.cpp
3209
JSImageData.cpp
3210
JSImageDataSettings.cpp
3210
JSImageSmoothingQuality.cpp
3211
JSImageSmoothingQuality.cpp
3211
JSInputEvent.cpp
3212
JSInputEvent.cpp
3212
JSInspectorAuditAccessibilityObject.cpp
3213
JSInspectorAuditAccessibilityObject.cpp
- Source/WebCore/WebCore.xcodeproj/project.pbxproj +6 lines
Lines 4095-4100 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
4095
		BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
4095
		BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
4096
		BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC97E238109144950010D361 /* HTMLAllCollection.h */; };
4096
		BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC97E238109144950010D361 /* HTMLAllCollection.h */; };
4097
		BC97E413109154FA0010D361 /* JSHTMLAllCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC97E411109154FA0010D361 /* JSHTMLAllCollection.h */; };
4097
		BC97E413109154FA0010D361 /* JSHTMLAllCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC97E411109154FA0010D361 /* JSHTMLAllCollection.h */; };
4098
		BCA088F5264E1C08003E2A6C /* ImageDataSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA088F2264E1BF9003E2A6C /* ImageDataSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
4098
		BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
4099
		BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
4099
		BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA257141293C010007A263D /* VerticalPositionCache.h */; };
4100
		BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA257141293C010007A263D /* VerticalPositionCache.h */; };
4100
		BCA2B061105047600043BD1C /* UserScript.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA2B0601050475F0043BD1C /* UserScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
4101
		BCA2B061105047600043BD1C /* UserScript.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA2B0601050475F0043BD1C /* UserScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 14315-14320 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
14315
		BC9A6142146859D9006057FD /* EventNames.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = EventNames.in; sourceTree = "<group>"; };
14316
		BC9A6142146859D9006057FD /* EventNames.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = EventNames.in; sourceTree = "<group>"; };
14316
		BC9A6145146859D9006057FD /* make_event_factory.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = make_event_factory.pl; sourceTree = "<group>"; };
14317
		BC9A6145146859D9006057FD /* make_event_factory.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = make_event_factory.pl; sourceTree = "<group>"; };
14317
		BC9A6146146859D9006057FD /* make_names.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = make_names.pl; sourceTree = "<group>"; };
14318
		BC9A6146146859D9006057FD /* make_names.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = make_names.pl; sourceTree = "<group>"; };
14319
		BCA088F2264E1BF9003E2A6C /* ImageDataSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageDataSettings.h; sourceTree = "<group>"; };
14320
		BCA088F4264E1BF9003E2A6C /* ImageDataSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ImageDataSettings.idl; sourceTree = "<group>"; };
14318
		BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableCaptionElement.cpp; sourceTree = "<group>"; };
14321
		BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableCaptionElement.cpp; sourceTree = "<group>"; };
14319
		BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableCaptionElement.h; sourceTree = "<group>"; };
14322
		BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableCaptionElement.h; sourceTree = "<group>"; };
14320
		BCA257141293C010007A263D /* VerticalPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerticalPositionCache.h; sourceTree = "<group>"; };
14323
		BCA257141293C010007A263D /* VerticalPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerticalPositionCache.h; sourceTree = "<group>"; };
Lines 23926-23931 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
23926
				A77979130D6B9D0C003851B9 /* ImageData.cpp */,
23929
				A77979130D6B9D0C003851B9 /* ImageData.cpp */,
23927
				A77979140D6B9D0C003851B9 /* ImageData.h */,
23930
				A77979140D6B9D0C003851B9 /* ImageData.h */,
23928
				A77979150D6B9D0C003851B9 /* ImageData.idl */,
23931
				A77979150D6B9D0C003851B9 /* ImageData.idl */,
23932
				BCA088F2264E1BF9003E2A6C /* ImageDataSettings.h */,
23933
				BCA088F4264E1BF9003E2A6C /* ImageDataSettings.idl */,
23929
				97205AB11239291000B17380 /* ImageDocument.cpp */,
23934
				97205AB11239291000B17380 /* ImageDocument.cpp */,
23930
				97205AB21239291000B17380 /* ImageDocument.h */,
23935
				97205AB21239291000B17380 /* ImageDocument.h */,
23931
				F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */,
23936
				F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */,
Lines 32887-32892 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
32887
				B2A10D910B3818BD00099AA4 /* ImageBufferPipe.h in Headers */,
32892
				B2A10D910B3818BD00099AA4 /* ImageBufferPipe.h in Headers */,
32888
				CD3E21DD2183444A00E66F55 /* ImageBufferUtilitiesCG.h in Headers */,
32893
				CD3E21DD2183444A00E66F55 /* ImageBufferUtilitiesCG.h in Headers */,
32889
				A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */,
32894
				A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */,
32895
				BCA088F5264E1C08003E2A6C /* ImageDataSettings.h in Headers */,
32890
				CD19FEA81F573972000C42FB /* ImageDecoder.h in Headers */,
32896
				CD19FEA81F573972000C42FB /* ImageDecoder.h in Headers */,
32891
				CD19FEAE1F574B6D000C42FB /* ImageDecoderAVFObjC.h in Headers */,
32897
				CD19FEAE1F574B6D000C42FB /* ImageDecoderAVFObjC.h in Headers */,
32892
				555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */,
32898
				555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */,
- Source/WebCore/bindings/js/SerializedScriptValue.cpp -12 / +6 lines
Lines 3141-3170 private: Source/WebCore/bindings/js/SerializedScriptValue.cpp_sec1
3141
            return JSValue();
3141
            return JSValue();
3142
        }
3142
        }
3143
3143
3144
        auto array = Uint8ClampedArray::tryCreate(WTFMove(arrayBuffer), 0, arrayBuffer->byteLength());
3145
        if (!array) {
3146
            fail();
3147
            return JSValue();
3148
        }
3149
3150
        IntSize logicalSize = IntSize(logicalWidth, logicalHeight);
3144
        IntSize logicalSize = IntSize(logicalWidth, logicalHeight);
3151
        IntSize imageDataSize = logicalSize;
3145
        IntSize imageDataSize = logicalSize;
3152
        imageDataSize.scale(resolutionScale);
3146
        imageDataSize.scale(resolutionScale);
3153
3147
3154
        // FIXME: Creating this ImageData is not necessary. We should skip right to creating a PixelBuffer directly.
3148
        auto buffer = ImageBitmap::createImageBuffer(*scriptExecutionContextFromExecState(m_lexicalGlobalObject), logicalSize, RenderingMode::Unaccelerated, resolutionScale);
3155
        auto imageData = ImageData::create(imageDataSize, array.releaseNonNull());
3149
        if (!buffer) {
3156
        if (!imageData) {
3157
            fail();
3150
            fail();
3158
            return JSValue();
3151
            return JSValue();
3159
        }
3152
        }
3160
3153
3161
        auto buffer = ImageBitmap::createImageBuffer(*scriptExecutionContextFromExecState(m_lexicalGlobalObject), logicalSize, RenderingMode::Unaccelerated, resolutionScale);
3154
        PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
3162
        if (!buffer) {
3155
        auto pixelBuffer = PixelBuffer::tryCreate(format, imageDataSize, arrayBuffer.releaseNonNull());
3156
        if (!pixelBuffer) {
3163
            fail();
3157
            fail();
3164
            return JSValue();
3158
            return JSValue();
3165
        }
3159
        }
3166
3160
3167
        buffer->putPixelBuffer(imageData->pixelBuffer(), { IntPoint::zero(), logicalSize });
3161
        buffer->putPixelBuffer(WTFMove(*pixelBuffer), { IntPoint::zero(), logicalSize });
3168
3162
3169
        auto bitmap = ImageBitmap::create(ImageBitmapBacking(WTFMove(buffer), OptionSet<SerializationState>::fromRaw(serializationState)));
3163
        auto bitmap = ImageBitmap::create(ImageBitmapBacking(WTFMove(buffer), OptionSet<SerializationState>::fromRaw(serializationState)));
3170
        return getJSValue(bitmap);
3164
        return getJSValue(bitmap);
- Source/WebCore/html/ImageData.cpp -20 / +55 lines
Lines 35-41 Source/WebCore/html/ImageData.cpp_sec1
35
35
36
namespace WebCore {
36
namespace WebCore {
37
37
38
Checked<unsigned, RecordOverflow> ImageData::dataSize(const IntSize& size)
38
static Checked<unsigned, RecordOverflow> computeDataSize(const IntSize& size)
39
{
39
{
40
    Checked<unsigned, RecordOverflow> checkedDataSize = 4;
40
    Checked<unsigned, RecordOverflow> checkedDataSize = 4;
41
    checkedDataSize *= static_cast<unsigned>(size.width());
41
    checkedDataSize *= static_cast<unsigned>(size.width());
Lines 43-51 Checked<unsigned, RecordOverflow> ImageD Source/WebCore/html/ImageData.cpp_sec2
43
    return checkedDataSize;
43
    return checkedDataSize;
44
}
44
}
45
45
46
PredefinedColorSpace ImageData::computeColorSpace(Optional<ImageDataSettings> settings, PredefinedColorSpace defaultColorSpace)
47
{
48
    if (settings && settings->colorSpace)
49
        return *settings->colorSpace;
50
    return defaultColorSpace;
51
}
52
46
Ref<ImageData> ImageData::create(PixelBuffer&& pixelBuffer)
53
Ref<ImageData> ImageData::create(PixelBuffer&& pixelBuffer)
47
{
54
{
48
    return adoptRef(*new ImageData(WTFMove(pixelBuffer)));
55
    auto colorSpace = toPredefinedColorSpace(pixelBuffer.format().colorSpace);
56
    RELEASE_ASSERT(colorSpace);
57
    return adoptRef(*new ImageData(pixelBuffer.size(), pixelBuffer.takeData(), *colorSpace));
49
}
58
}
50
59
51
RefPtr<ImageData> ImageData::create(Optional<PixelBuffer>&& pixelBuffer)
60
RefPtr<ImageData> ImageData::create(Optional<PixelBuffer>&& pixelBuffer)
Lines 57-99 RefPtr<ImageData> ImageData::create(Opti Source/WebCore/html/ImageData.cpp_sec3
57
66
58
RefPtr<ImageData> ImageData::create(const IntSize& size)
67
RefPtr<ImageData> ImageData::create(const IntSize& size)
59
{
68
{
60
    auto dataSize = ImageData::dataSize(size);
69
    auto dataSize = computeDataSize(size);
61
    if (dataSize.hasOverflowed())
70
    if (dataSize.hasOverflowed())
62
        return nullptr;
71
        return nullptr;
63
    auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
72
    auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
64
    if (!byteArray)
73
    if (!byteArray)
65
        return nullptr;
74
        return nullptr;
66
    
75
    return adoptRef(*new ImageData(size, byteArray.releaseNonNull(), PredefinedColorSpace::SRGB));
67
    return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, byteArray.releaseNonNull() }));
68
}
76
}
69
77
70
RefPtr<ImageData> ImageData::create(const IntSize& size, Ref<Uint8ClampedArray>&& byteArray)
78
RefPtr<ImageData> ImageData::create(const IntSize& size, Ref<Uint8ClampedArray>&& byteArray, PredefinedColorSpace colorSpace)
71
{
79
{
72
    auto dataSize = ImageData::dataSize(size);
80
    auto dataSize = computeDataSize(size);
73
    if (dataSize.hasOverflowed() || dataSize.unsafeGet() > byteArray->length())
81
    if (dataSize.hasOverflowed() || dataSize.unsafeGet() != byteArray->length())
74
        return nullptr;
82
        return nullptr;
75
83
76
    return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, WTFMove(byteArray) }));
84
    return adoptRef(*new ImageData(size, WTFMove(byteArray), colorSpace));
77
}
85
}
78
86
79
ExceptionOr<Ref<ImageData>> ImageData::create(unsigned sw, unsigned sh)
87
ExceptionOr<Ref<ImageData>> ImageData::createUninitialized(unsigned rows, unsigned pixelsPerRow, PredefinedColorSpace defaultColorSpace, Optional<ImageDataSettings> settings)
88
{
89
    IntSize size(rows, pixelsPerRow);
90
    auto dataSize = computeDataSize(size);
91
    if (dataSize.hasOverflowed())
92
        return Exception { RangeError, "Cannot allocate a buffer of this size"_s };
93
94
    auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
95
    if (!byteArray) {
96
        // FIXME: Does this need to be a "real" out of memory error with setOutOfMemoryError called on it?
97
        return Exception { RangeError, "Out of memory"_s };
98
    }
99
100
    auto colorSpace = computeColorSpace(settings, defaultColorSpace);
101
    return adoptRef(*new ImageData(size, byteArray.releaseNonNull(), colorSpace));
102
}
103
104
ExceptionOr<Ref<ImageData>> ImageData::create(unsigned sw, unsigned sh, Optional<ImageDataSettings> settings)
80
{
105
{
81
    if (!sw || !sh)
106
    if (!sw || !sh)
82
        return Exception { IndexSizeError };
107
        return Exception { IndexSizeError };
108
83
    IntSize size(sw, sh);
109
    IntSize size(sw, sh);
84
    auto dataSize = ImageData::dataSize(size);
110
    auto dataSize = computeDataSize(size);
85
    if (dataSize.hasOverflowed())
111
    if (dataSize.hasOverflowed())
86
        return Exception { RangeError, "Cannot allocate a buffer of this size"_s };
112
        return Exception { RangeError, "Cannot allocate a buffer of this size"_s };
113
87
    auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
114
    auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
88
    if (!byteArray) {
115
    if (!byteArray) {
89
        // FIXME: Does this need to be a "real" out of memory error with setOutOfMemoryError called on it?
116
        // FIXME: Does this need to be a "real" out of memory error with setOutOfMemoryError called on it?
90
        return Exception { RangeError, "Out of memory"_s };
117
        return Exception { RangeError, "Out of memory"_s };
91
    }
118
    }
92
    byteArray->zeroFill();
119
    byteArray->zeroFill();
93
    return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, byteArray.releaseNonNull() }));
120
121
    auto colorSpace = computeColorSpace(settings);
122
    return adoptRef(*new ImageData(size, byteArray.releaseNonNull(), colorSpace));
94
}
123
}
95
124
96
ExceptionOr<Ref<ImageData>> ImageData::create(Ref<Uint8ClampedArray>&& byteArray, unsigned sw, Optional<unsigned> sh)
125
ExceptionOr<Ref<ImageData>> ImageData::create(Ref<Uint8ClampedArray>&& byteArray, unsigned sw, Optional<unsigned> sh, Optional<ImageDataSettings> settings)
97
{
126
{
98
    unsigned length = byteArray->length();
127
    unsigned length = byteArray->length();
99
    if (!length || length % 4)
128
    if (!length || length % 4)
Lines 107-128 ExceptionOr<Ref<ImageData>> ImageData::c Source/WebCore/html/ImageData.cpp_sec4
107
    if (sh && sh.value() != height)
136
    if (sh && sh.value() != height)
108
        return Exception { IndexSizeError, "sh value is not equal to height"_s };
137
        return Exception { IndexSizeError, "sh value is not equal to height"_s };
109
138
110
    auto result = create(IntSize(sw, height), WTFMove(byteArray));
139
    IntSize size(sw, height);
111
    if (!result)
140
    auto dataSize = computeDataSize(size);
141
    if (dataSize.hasOverflowed() || dataSize.unsafeGet() != byteArray->length())
112
        return Exception { RangeError };
142
        return Exception { RangeError };
113
    return result.releaseNonNull();
143
144
    auto colorSpace = computeColorSpace(settings);
145
    return adoptRef(*new ImageData(size, WTFMove(byteArray), colorSpace));
114
}
146
}
115
147
116
ImageData::ImageData(PixelBuffer&& pixelBuffer)
148
ImageData::ImageData(const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data, PredefinedColorSpace colorSpace)
117
    : m_pixelBuffer(WTFMove(pixelBuffer))
149
    : m_size(size)
150
    , m_data(WTFMove(data))
151
    , m_colorSpace(colorSpace)
118
{
152
{
119
}
153
}
120
154
121
ImageData::~ImageData() = default;
155
ImageData::~ImageData() = default;
122
156
123
Ref<ImageData> ImageData::deepClone() const
157
PixelBuffer ImageData::pixelBuffer() const
124
{
158
{
125
    return adoptRef(*new ImageData(m_pixelBuffer.deepClone()));
159
    PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, toDestinationColorSpace(m_colorSpace) };
160
    return { format, m_size, m_data.get() };
126
}
161
}
127
162
128
TextStream& operator<<(TextStream& ts, const ImageData& imageData)
163
TextStream& operator<<(TextStream& ts, const ImageData& imageData)
- Source/WebCore/html/ImageData.h -14 / +22 lines
Lines 29-35 Source/WebCore/html/ImageData.h_sec1
29
#pragma once
29
#pragma once
30
30
31
#include "ExceptionOr.h"
31
#include "ExceptionOr.h"
32
#include "ImageDataSettings.h"
33
#include "IntSize.h"
32
#include "PixelBuffer.h"
34
#include "PixelBuffer.h"
35
#include "PredefinedColorSpace.h"
36
#include <JavaScriptCore/Uint8ClampedArray.h>
37
#include <wtf/Forward.h>
33
38
34
namespace WebCore {
39
namespace WebCore {
35
40
Lines 38-66 public: Source/WebCore/html/ImageData.h_sec2
38
    WEBCORE_EXPORT static Ref<ImageData> create(PixelBuffer&&);
43
    WEBCORE_EXPORT static Ref<ImageData> create(PixelBuffer&&);
39
    WEBCORE_EXPORT static RefPtr<ImageData> create(Optional<PixelBuffer>&&);
44
    WEBCORE_EXPORT static RefPtr<ImageData> create(Optional<PixelBuffer>&&);
40
    WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&);
45
    WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&);
41
    WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&, Ref<Uint8ClampedArray>&&);
46
    WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&, Ref<Uint8ClampedArray>&&, PredefinedColorSpace);
42
    WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> create(unsigned sw, unsigned sh);
47
    WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> createUninitialized(unsigned rows, unsigned pixelsPerRow, PredefinedColorSpace defaultColorSpace, Optional<ImageDataSettings> = WTF::nullopt);
43
    WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> create(Ref<Uint8ClampedArray>&&, unsigned sw, Optional<unsigned> sh);
48
    WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> create(unsigned sw, unsigned sh, Optional<ImageDataSettings>);
49
    WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> create(Ref<Uint8ClampedArray>&&, unsigned sw, Optional<unsigned> sh, Optional<ImageDataSettings>);
50
44
    WEBCORE_EXPORT ~ImageData();
51
    WEBCORE_EXPORT ~ImageData();
45
52
46
    const IntSize& size() const { return m_pixelBuffer.size(); }
53
    static PredefinedColorSpace computeColorSpace(Optional<ImageDataSettings>, PredefinedColorSpace defaultColorSpace = PredefinedColorSpace::SRGB);
47
    int width() const { return m_pixelBuffer.size().width(); }
48
    int height() const { return m_pixelBuffer.size().height(); }
49
54
50
    Uint8ClampedArray& data() const { return m_pixelBuffer.data(); }
55
    const IntSize& size() const { return m_size; }
51
56
52
    Ref<ImageData> deepClone() const;
57
    int width() const { return m_size.width(); }
58
    int height() const { return m_size.height(); }
59
    Uint8ClampedArray& data() const { return m_data.get(); }
60
    PredefinedColorSpace colorSpace() const { return m_colorSpace; }
53
61
54
    const PixelBuffer& pixelBuffer() const { return m_pixelBuffer; }
62
    PixelBuffer pixelBuffer() const;
55
63
56
private:
64
private:
57
    explicit ImageData(PixelBuffer&&);
65
    explicit ImageData(const IntSize&, Ref<JSC::Uint8ClampedArray>&&, PredefinedColorSpace);
58
59
    static Checked<unsigned, RecordOverflow> dataSize(const IntSize&);
60
66
61
    PixelBuffer m_pixelBuffer;
67
    IntSize m_size;
68
    Ref<JSC::Uint8ClampedArray> m_data;
69
    PredefinedColorSpace m_colorSpace;
62
};
70
};
63
71
64
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const ImageData&);
72
WEBCORE_EXPORT TextStream& operator<<(TextStream&, const ImageData&);
65
73
66
} // namespace WebCore
74
} // namespace WebCore
- Source/WebCore/html/ImageData.idl -3 / +4 lines
Lines 1-5 Source/WebCore/html/ImageData.idl_sec1
1
/*
1
/*
2
 * Copyright (C) 2008-2009, 2016 Apple Inc. All rights reserved.
2
 * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
5
 * modification, are permitted provided that the following conditions
Lines 32-41 Source/WebCore/html/ImageData.idl_sec2
32
    Exposed=(Window,Worker),
32
    Exposed=(Window,Worker),
33
    ImplementationLacksVTable
33
    ImplementationLacksVTable
34
] interface ImageData {
34
] interface ImageData {
35
    constructor(unsigned long sw, unsigned long sh);
35
    constructor(unsigned long sw, unsigned long sh, optional ImageDataSettings settings);
36
    constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh);
36
    constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh, optional ImageDataSettings settings);
37
37
38
    readonly attribute unsigned long width;
38
    readonly attribute unsigned long width;
39
    readonly attribute unsigned long height;
39
    readonly attribute unsigned long height;
40
    readonly attribute Uint8ClampedArray data;
40
    readonly attribute Uint8ClampedArray data;
41
    [EnabledBySetting=CanvasColorSpace] readonly attribute PredefinedColorSpace colorSpace;
41
};
42
};
- Source/WebCore/html/ImageDataSettings.h +37 lines
Line 0 Source/WebCore/html/ImageDataSettings.h_sec1
1
/*
2
 * Copyright (C) 2021 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#pragma once
27
28
#include "PredefinedColorSpace.h"
29
#include <wtf/Optional.h>
30
31
namespace WebCore {
32
33
struct ImageDataSettings {
34
    Optional<PredefinedColorSpace> colorSpace;
35
};
36
37
} // namespace WebCore
- Source/WebCore/html/ImageDataSettings.idl +29 lines
Line 0 Source/WebCore/html/ImageDataSettings.idl_sec1
1
/*
2
 * Copyright (C) 2021 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
// https://html.spec.whatwg.org/multipage/canvas.html#imagedatasettings
27
dictionary ImageDataSettings {
28
    [EnabledBySetting=CanvasColorSpace] PredefinedColorSpace colorSpace;
29
};
- Source/WebCore/html/canvas/CanvasImageData.idl -3 / +3 lines
Lines 1-5 Source/WebCore/html/canvas/CanvasImageData.idl_sec1
1
/*
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
2
 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
5
 * modification, are permitted provided that the following conditions
Lines 26-34 Source/WebCore/html/canvas/CanvasImageData.idl_sec2
26
// https://html.spec.whatwg.org/multipage/canvas.html#canvasimagedata
26
// https://html.spec.whatwg.org/multipage/canvas.html#canvasimagedata
27
interface mixin CanvasImageData {
27
interface mixin CanvasImageData {
28
    // pixel manipulation
28
    // pixel manipulation
29
    ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh);
29
    ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings);
30
    ImageData createImageData(ImageData imagedata);
30
    ImageData createImageData(ImageData imagedata);
31
    ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh);
31
    ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings);
32
    undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy);
32
    undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy);
33
    undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight);
33
    undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight);
34
};
34
};
- Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp -17 / +37 lines
Lines 2152-2190 bool CanvasRenderingContext2DBase::needs Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp_sec1
2152
    return false;
2152
    return false;
2153
}
2153
}
2154
2154
2155
static RefPtr<ImageData> createEmptyImageData(const IntSize& size)
2155
static void initializeEmptyImageData(const ImageData& imageData)
2156
{
2156
{
2157
    auto data = ImageData::create(size);
2157
    // FIXME: Add support for initializing the ImageData when settings.alpha is false, requiring
2158
    if (data)
2158
    // every 4th byte to be 0xFF.
2159
        data->data().zeroFill();
2159
2160
    return data;
2160
    imageData.data().zeroFill();
2161
}
2161
}
2162
2162
2163
RefPtr<ImageData> CanvasRenderingContext2DBase::createImageData(ImageData& imageData) const
2163
ExceptionOr<Ref<ImageData>> CanvasRenderingContext2DBase::createImageData(ImageData& imageData) const
2164
{
2164
{
2165
    return createEmptyImageData(imageData.size());
2165
    auto newImageData = ImageData::createUninitialized(imageData.width(), imageData.height(), imageData.colorSpace());
2166
    if (newImageData.hasException())
2167
        return newImageData.releaseException();
2168
2169
    initializeEmptyImageData(newImageData.returnValue());
2170
2171
    return newImageData;
2166
}
2172
}
2167
2173
2168
ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2DBase::createImageData(int sw, int sh) const
2174
ExceptionOr<Ref<ImageData>> CanvasRenderingContext2DBase::createImageData(int sw, int sh, Optional<ImageDataSettings> settings) const
2169
{
2175
{
2170
    if (!sw || !sh)
2176
    if (!sw || !sh)
2171
        return Exception { IndexSizeError };
2177
        return Exception { IndexSizeError };
2172
2178
2173
    IntSize size { std::abs(sw), std::abs(sh) };
2179
    auto imageData = ImageData::createUninitialized(std::abs(sw), std::abs(sh), m_settings.colorSpace, settings);
2174
    return createEmptyImageData(size);
2180
    if (imageData.hasException())
2181
        return imageData.releaseException();
2182
2183
    initializeEmptyImageData(imageData.returnValue());
2184
2185
    return imageData;
2175
}
2186
}
2176
2187
2177
ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2DBase::getImageData(int sx, int sy, int sw, int sh) const
2188
ExceptionOr<Ref<ImageData>> CanvasRenderingContext2DBase::getImageData(int sx, int sy, int sw, int sh, Optional<ImageDataSettings> settings) const
2178
{
2189
{
2190
    if (!sw || !sh)
2191
        return Exception { IndexSizeError };
2192
2179
    if (!canvasBase().originClean()) {
2193
    if (!canvasBase().originClean()) {
2180
        static NeverDestroyed<String> consoleMessage(MAKE_STATIC_STRING_IMPL("Unable to get image data from canvas because the canvas has been tainted by cross-origin data."));
2194
        static NeverDestroyed<String> consoleMessage(MAKE_STATIC_STRING_IMPL("Unable to get image data from canvas because the canvas has been tainted by cross-origin data."));
2181
        canvasBase().scriptExecutionContext()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage);
2195
        canvasBase().scriptExecutionContext()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage);
2182
        return Exception { SecurityError };
2196
        return Exception { SecurityError };
2183
    }
2197
    }
2184
2198
2185
    if (!sw || !sh)
2186
        return Exception { IndexSizeError };
2187
2188
    if (sw < 0) {
2199
    if (sw < 0) {
2189
        sx += sw;
2200
        sx += sw;
2190
        sw = -sw;
2201
        sw = -sw;
Lines 2197-2206 ExceptionOr<RefPtr<ImageData>> CanvasRen Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp_sec2
2197
    IntRect imageDataRect { sx, sy, sw, sh };
2208
    IntRect imageDataRect { sx, sy, sw, sh };
2198
2209
2199
    ImageBuffer* buffer = canvasBase().buffer();
2210
    ImageBuffer* buffer = canvasBase().buffer();
2200
    if (!buffer)
2211
    if (!buffer) {
2201
        return createEmptyImageData(imageDataRect.size());
2212
        auto imageData = ImageData::createUninitialized(imageDataRect.width(), imageDataRect.height(), m_settings.colorSpace, settings);
2213
        if (imageData.hasException())
2214
            return imageData.releaseException();
2215
2216
        initializeEmptyImageData(imageData.returnValue());
2217
        
2218
        return imageData;
2219
    }
2220
2221
    auto computedColorSpace = ImageData::computeColorSpace(settings, m_settings.colorSpace);
2202
2222
2203
    PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
2223
    PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, toDestinationColorSpace(computedColorSpace) };
2204
    auto pixelBuffer = buffer->getPixelBuffer(format, imageDataRect);
2224
    auto pixelBuffer = buffer->getPixelBuffer(format, imageDataRect);
2205
    if (!pixelBuffer) {
2225
    if (!pixelBuffer) {
2206
        canvasBase().scriptExecutionContext()->addConsoleMessage(MessageSource::Rendering, MessageLevel::Error,
2226
        canvasBase().scriptExecutionContext()->addConsoleMessage(MessageSource::Rendering, MessageLevel::Error,
- Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h -3 / +4 lines
Lines 43-48 Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h_sec1
43
#include "GraphicsContext.h"
43
#include "GraphicsContext.h"
44
#include "GraphicsTypes.h"
44
#include "GraphicsTypes.h"
45
#include "ImageBuffer.h"
45
#include "ImageBuffer.h"
46
#include "ImageDataSettings.h"
46
#include "ImageSmoothingQuality.h"
47
#include "ImageSmoothingQuality.h"
47
#include "Path.h"
48
#include "Path.h"
48
#include "PlatformLayer.h"
49
#include "PlatformLayer.h"
Lines 191-199 public: Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h_sec2
191
    ExceptionOr<Ref<CanvasGradient>> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
192
    ExceptionOr<Ref<CanvasGradient>> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
192
    ExceptionOr<RefPtr<CanvasPattern>> createPattern(CanvasImageSource&&, const String& repetition);
193
    ExceptionOr<RefPtr<CanvasPattern>> createPattern(CanvasImageSource&&, const String& repetition);
193
194
194
    RefPtr<ImageData> createImageData(ImageData&) const;
195
    ExceptionOr<Ref<ImageData>> createImageData(ImageData&) const;
195
    ExceptionOr<RefPtr<ImageData>> createImageData(int width, int height) const;
196
    ExceptionOr<Ref<ImageData>> createImageData(int width, int height, Optional<ImageDataSettings>) const;
196
    ExceptionOr<RefPtr<ImageData>> getImageData(int sx, int sy, int sw, int sh) const;
197
    ExceptionOr<Ref<ImageData>> getImageData(int sx, int sy, int sw, int sh, Optional<ImageDataSettings>) const;
197
    void putImageData(ImageData&, int dx, int dy);
198
    void putImageData(ImageData&, int dx, int dy);
198
    void putImageData(ImageData&, int dx, int dy, int dirtyX, int dirtyY, int dirtyWidth, int dirtyHeight);
199
    void putImageData(ImageData&, int dx, int dy, int dirtyX, int dirtyY, int dirtyWidth, int dirtyHeight);
199
200
- Source/WebCore/html/canvas/PredefinedColorSpace.cpp +19 lines
Lines 45-48 DestinationColorSpace toDestinationColor Source/WebCore/html/canvas/PredefinedColorSpace.cpp_sec1
45
    return DestinationColorSpace::SRGB;
45
    return DestinationColorSpace::SRGB;
46
}
46
}
47
47
48
Optional<PredefinedColorSpace> toPredefinedColorSpace(DestinationColorSpace colorSpace)
49
{
50
    switch (colorSpace) {
51
    case DestinationColorSpace::SRGB:
52
        return PredefinedColorSpace::SRGB;
53
#if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB)
54
    case DestinationColorSpace::LinearSRGB:
55
        return WTF::nullopt;
56
#endif
57
#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
58
    case DestinationColorSpace::DisplayP3:
59
        return PredefinedColorSpace::DisplayP3;
60
#endif
61
    }
62
63
    ASSERT_NOT_REACHED();
64
    return WTF::nullopt;
65
}
66
48
}
67
}
- Source/WebCore/html/canvas/PredefinedColorSpace.h +2 lines
Lines 26-31 Source/WebCore/html/canvas/PredefinedColorSpace.h_sec1
26
#pragma once
26
#pragma once
27
27
28
#include <wtf/EnumTraits.h>
28
#include <wtf/EnumTraits.h>
29
#include <wtf/Optional.h>
29
30
30
namespace WebCore {
31
namespace WebCore {
31
32
Lines 39-44 enum class PredefinedColorSpace { Source/WebCore/html/canvas/PredefinedColorSpace.h_sec2
39
};
40
};
40
41
41
DestinationColorSpace toDestinationColorSpace(PredefinedColorSpace);
42
DestinationColorSpace toDestinationColorSpace(PredefinedColorSpace);
43
Optional<PredefinedColorSpace> toPredefinedColorSpace(DestinationColorSpace);
42
44
43
}
45
}
44
46
- Source/WebCore/inspector/InspectorCanvas.cpp +6 lines
Lines 428-433 Optional<InspectorCanvasCallTracer::Proc Source/WebCore/inspector/InspectorCanvas.cpp_sec1
428
    return {{ valueIndexForData(argument), RecordingSwizzleType::ImageData }};
428
    return {{ valueIndexForData(argument), RecordingSwizzleType::ImageData }};
429
}
429
}
430
430
431
Optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(ImageDataSettings&)
432
{
433
    // FIXME: Implement.
434
    return WTF::nullopt;
435
}
436
431
Optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(ImageSmoothingQuality argument)
437
Optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(ImageSmoothingQuality argument)
432
{
438
{
433
    return {{ valueIndexForData(convertEnumerationToString(argument)), RecordingSwizzleType::String }};
439
    return {{ valueIndexForData(convertEnumerationToString(argument)), RecordingSwizzleType::String }};
- Source/WebCore/inspector/InspectorCanvasCallTracer.cpp +1 lines
Lines 37-42 Source/WebCore/inspector/InspectorCanvasCallTracer.cpp_sec1
37
#include "HTMLImageElement.h"
37
#include "HTMLImageElement.h"
38
#include "HTMLVideoElement.h"
38
#include "HTMLVideoElement.h"
39
#include "ImageData.h"
39
#include "ImageData.h"
40
#include "ImageDataSettings.h"
40
#include "InspectorCanvasAgent.h"
41
#include "InspectorCanvasAgent.h"
41
#include "InspectorInstrumentation.h"
42
#include "InspectorInstrumentation.h"
42
#include "InstrumentingAgents.h"
43
#include "InstrumentingAgents.h"
- Source/WebCore/inspector/InspectorCanvasCallTracer.h +2 lines
Lines 70-75 class WebGLTransformFeedback; Source/WebCore/inspector/InspectorCanvasCallTracer.h_sec1
70
class WebGLUniformLocation;
70
class WebGLUniformLocation;
71
class WebGLVertexArrayObject;
71
class WebGLVertexArrayObject;
72
struct DOMMatrix2DInit;
72
struct DOMMatrix2DInit;
73
struct ImageDataSettings;
73
enum class RecordingSwizzleType : int;
74
enum class RecordingSwizzleType : int;
74
enum class CanvasDirection;
75
enum class CanvasDirection;
75
enum class CanvasFillRule;
76
enum class CanvasFillRule;
Lines 150-155 enum ImageSmoothingQuality; Source/WebCore/inspector/InspectorCanvasCallTracer.h_sec2
150
    macro(HTMLImageElement*) \
151
    macro(HTMLImageElement*) \
151
    macro(ImageBitmap*) \
152
    macro(ImageBitmap*) \
152
    macro(ImageData*) \
153
    macro(ImageData*) \
154
    macro(ImageDataSettings&) \
153
    macro(ImageSmoothingQuality) \
155
    macro(ImageSmoothingQuality) \
154
    macro(Optional<float>&) \
156
    macro(Optional<float>&) \
155
    macro(Path2D*) \
157
    macro(Path2D*) \
- Source/WebCore/platform/graphics/ImageBufferBackend.cpp -33 / +19 lines
Lines 116-121 Vector<uint8_t> ImageBufferBackend::toBG Source/WebCore/platform/graphics/ImageBufferBackend.cpp_sec1
116
116
117
Optional<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data) const
117
Optional<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data) const
118
{
118
{
119
    // FIXME: Add support for non 8-bit pixel formats.
120
    ASSERT(destinationFormat.pixelFormat == PixelFormat::RGBA8 || destinationFormat.pixelFormat == PixelFormat::BGRA8);
121
119
    auto sourceRectScaled = toBackendCoordinates(sourceRect);
122
    auto sourceRectScaled = toBackendCoordinates(sourceRect);
120
123
121
    auto pixelBuffer = PixelBuffer::tryCreate(destinationFormat, sourceRectScaled.size());
124
    auto pixelBuffer = PixelBuffer::tryCreate(destinationFormat, sourceRectScaled.size());
Lines 134-156 Optional<PixelBuffer> ImageBufferBackend Source/WebCore/platform/graphics/ImageBufferBackend.cpp_sec2
134
    if (destinationRect.size() != sourceRectScaled.size())
137
    if (destinationRect.size() != sourceRectScaled.size())
135
        pixelBuffer->data().zeroFill();
138
        pixelBuffer->data().zeroFill();
136
139
137
    unsigned sourceBytesPerRow = bytesPerRow();
138
    const uint8_t* sourceRows = reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4;
139
140
    unsigned destinationBytesPerRow = 4 * sourceRectScaled.width();
141
    uint8_t* destinationRows = pixelBuffer->data().data() + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4;
142
143
    PixelBufferFormat sourceFormat { AlphaPremultiplication::Premultiplied, pixelFormat(), DestinationColorSpace::SRGB };
144
145
    ConstPixelBufferConversionView source;
140
    ConstPixelBufferConversionView source;
146
    source.format = sourceFormat;
141
    source.format = { AlphaPremultiplication::Premultiplied, pixelFormat(), colorSpace() };
147
    source.bytesPerRow = sourceBytesPerRow;
142
    source.bytesPerRow = bytesPerRow();
148
    source.rows = sourceRows;
143
    source.rows = reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4;
149
    
144
    
150
    PixelBufferConversionView destination;
145
    PixelBufferConversionView destination;
151
    destination.format = destinationFormat;
146
    destination.format = destinationFormat;
152
    destination.bytesPerRow = destinationBytesPerRow;
147
    destination.bytesPerRow = 4 * sourceRectScaled.width();
153
    destination.rows = destinationRows;
148
    destination.rows = pixelBuffer->data().data() + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4;
154
149
155
    convertImagePixels(source, destination, destinationRect.size());
150
    convertImagePixels(source, destination, destinationRect.size());
156
151
Lines 159-172 Optional<PixelBuffer> ImageBufferBackend Source/WebCore/platform/graphics/ImageBufferBackend.cpp_sec3
159
154
160
void ImageBufferBackend::putPixelBuffer(const PixelBuffer& sourcePixelBuffer, const IntRect& sourceRect, const IntPoint& destinationPoint, AlphaPremultiplication destinationAlphaFormat, void* data)
155
void ImageBufferBackend::putPixelBuffer(const PixelBuffer& sourcePixelBuffer, const IntRect& sourceRect, const IntPoint& destinationPoint, AlphaPremultiplication destinationAlphaFormat, void* data)
161
{
156
{
162
    // FIXME: Add support for non-RGBA8 pixel formats.
157
    // FIXME: Add support for non 8-bit pixel formats.
163
    ASSERT(sourcePixelBuffer.format().pixelFormat == PixelFormat::RGBA8);
158
    ASSERT(sourcePixelBuffer.format().pixelFormat == PixelFormat::RGBA8 || sourcePixelBuffer.format().pixelFormat == PixelFormat::BGRA8);
164
159
165
    auto sourceRectScaled = toBackendCoordinates(sourceRect);
160
    auto sourceRectScaled = toBackendCoordinates(sourceRect);
166
    auto destinationPointScaled = toBackendCoordinates(destinationPoint);
161
    auto destinationPointScaled = toBackendCoordinates(destinationPoint);
167
162
168
    IntRect sourceRectClipped = intersection({ IntPoint::zero(), sourcePixelBuffer.size() }, sourceRectScaled);
163
    auto sourceRectClipped = intersection({ IntPoint::zero(), sourcePixelBuffer.size() }, sourceRectScaled);
169
    IntRect destinationRect = sourceRectClipped;
164
    auto destinationRect = sourceRectClipped;
170
    destinationRect.moveBy(destinationPointScaled);
165
    destinationRect.moveBy(destinationPointScaled);
171
166
172
    if (sourceRectScaled.x() < 0)
167
    if (sourceRectScaled.x() < 0)
Lines 178-201 void ImageBufferBackend::putPixelBuffer( Source/WebCore/platform/graphics/ImageBufferBackend.cpp_sec4
178
    destinationRect.intersect(backendRect());
173
    destinationRect.intersect(backendRect());
179
    sourceRectClipped.setSize(destinationRect.size());
174
    sourceRectClipped.setSize(destinationRect.size());
180
175
181
    unsigned sourceBytesPerRow = 4 * sourcePixelBuffer.size().width();
182
    const uint8_t* sourceRows = sourcePixelBuffer.data().data() + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4;
183
184
    unsigned destinationBytesPerRow = bytesPerRow();
185
    uint8_t* destinationRows = reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4;
186
187
    PixelBufferFormat sourceFormat = sourcePixelBuffer.format();
188
    PixelBufferFormat destinationFormat { destinationAlphaFormat, pixelFormat(), DestinationColorSpace::SRGB };
189
190
    ConstPixelBufferConversionView source;
176
    ConstPixelBufferConversionView source;
191
    source.format = sourceFormat;
177
    source.format = sourcePixelBuffer.format();
192
    source.bytesPerRow = sourceBytesPerRow;
178
    source.bytesPerRow = 4 * sourcePixelBuffer.size().width();
193
    source.rows = sourceRows;
179
    source.rows = sourcePixelBuffer.data().data() + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4;
194
    
180
195
    PixelBufferConversionView destination;
181
    PixelBufferConversionView destination;
196
    destination.format = destinationFormat;
182
    destination.format = { destinationAlphaFormat, pixelFormat(), colorSpace() };
197
    destination.bytesPerRow = destinationBytesPerRow;
183
    destination.bytesPerRow = bytesPerRow();
198
    destination.rows = destinationRows;
184
    destination.rows = reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4;
199
185
200
    convertImagePixels(source, destination, destinationRect.size());
186
    convertImagePixels(source, destination, destinationRect.size());
201
}
187
}
- Source/WebCore/platform/graphics/PixelBuffer.cpp +24 lines
Lines 66-71 Optional<PixelBuffer> PixelBuffer::tryCr Source/WebCore/platform/graphics/PixelBuffer.cpp_sec1
66
    return { { format, size, pixelArray.releaseNonNull() } };
66
    return { { format, size, pixelArray.releaseNonNull() } };
67
}
67
}
68
68
69
Optional<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::ArrayBuffer>&& arrayBuffer)
70
{
71
    // NOTE: Only 8-bit formats are currently supported.
72
    ASSERT(format.pixelFormat == PixelFormat::RGBA8 || format.pixelFormat == PixelFormat::BGRA8);
73
74
    auto bufferSize = computeBufferSize(format, size);
75
    if (bufferSize.hasOverflowed())
76
        return WTF::nullopt;
77
    if (bufferSize.unsafeGet() != arrayBuffer->byteLength())
78
        return WTF::nullopt;
79
    auto pixelArray = Uint8ClampedArray::tryCreate(WTFMove(arrayBuffer), 0, bufferSize.unsafeGet());
80
    if (!pixelArray)
81
        return WTF::nullopt;
82
    return { { format, size, pixelArray.releaseNonNull() } };
83
}
84
69
PixelBuffer::PixelBuffer(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data)
85
PixelBuffer::PixelBuffer(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data)
70
    : m_format { format }
86
    : m_format { format }
71
    , m_size { size }
87
    , m_size { size }
Lines 74-79 PixelBuffer::PixelBuffer(const PixelBuff Source/WebCore/platform/graphics/PixelBuffer.cpp_sec2
74
    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION((m_size.area() * 4).unsafeGet() <= m_data->length());
90
    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION((m_size.area() * 4).unsafeGet() <= m_data->length());
75
}
91
}
76
92
93
PixelBuffer::PixelBuffer(const PixelBufferFormat& format, const IntSize& size, JSC::Uint8ClampedArray& data)
94
    : m_format { format }
95
    , m_size { size }
96
    , m_data { data }
97
{
98
    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION((m_size.area() * 4).unsafeGet() <= m_data->length());
99
}
100
77
PixelBuffer::~PixelBuffer() = default;
101
PixelBuffer::~PixelBuffer() = default;
78
102
79
PixelBuffer PixelBuffer::deepClone() const
103
PixelBuffer PixelBuffer::deepClone() const
- Source/WebCore/platform/graphics/PixelBuffer.h +4 lines
Lines 42-49 class PixelBuffer { Source/WebCore/platform/graphics/PixelBuffer.h_sec1
42
    WTF_MAKE_NONCOPYABLE(PixelBuffer);
42
    WTF_MAKE_NONCOPYABLE(PixelBuffer);
43
public:
43
public:
44
    WEBCORE_EXPORT static Optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&);
44
    WEBCORE_EXPORT static Optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&);
45
    WEBCORE_EXPORT static Optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&, Ref<JSC::ArrayBuffer>&&);
45
46
46
    PixelBuffer(const PixelBufferFormat&, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
47
    PixelBuffer(const PixelBufferFormat&, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
48
    PixelBuffer(const PixelBufferFormat&, const IntSize&, JSC::Uint8ClampedArray&);
47
    WEBCORE_EXPORT ~PixelBuffer();
49
    WEBCORE_EXPORT ~PixelBuffer();
48
50
49
    PixelBuffer(PixelBuffer&&) = default;
51
    PixelBuffer(PixelBuffer&&) = default;
Lines 53-58 public: Source/WebCore/platform/graphics/PixelBuffer.h_sec2
53
    const IntSize& size() const { return m_size; }
55
    const IntSize& size() const { return m_size; }
54
    JSC::Uint8ClampedArray& data() const { return m_data.get(); }
56
    JSC::Uint8ClampedArray& data() const { return m_data.get(); }
55
57
58
    Ref<JSC::Uint8ClampedArray>&& takeData() { return WTFMove(m_data); }
59
56
    PixelBuffer deepClone() const;
60
    PixelBuffer deepClone() const;
57
61
58
    template<class Encoder> void encode(Encoder&) const;
62
    template<class Encoder> void encode(Encoder&) const;
- Source/WebCore/platform/graphics/PixelBufferConversion.cpp -1 / +1 lines
Lines 106-112 static void convertImagePixelsAccelerate Source/WebCore/platform/graphics/PixelBufferConversion.cpp_sec1
106
106
107
        vImage_Error converterCreateError = kvImageNoError;
107
        vImage_Error converterCreateError = kvImageNoError;
108
        auto converter = adoptCF(vImageConverter_CreateWithCGImageFormat(&sourceCGImageFormat, &destinationCGImageFormat, nullptr, kvImageNoFlags, &converterCreateError));
108
        auto converter = adoptCF(vImageConverter_CreateWithCGImageFormat(&sourceCGImageFormat, &destinationCGImageFormat, nullptr, kvImageNoFlags, &converterCreateError));
109
        ASSERT_WITH_MESSAGE_UNUSED(converterCreateError, converterCreateError != kvImageNoError, "vImageConverter creation failed with error: %zd", converterCreateError);
109
        ASSERT_WITH_MESSAGE_UNUSED(converterCreateError, converterCreateError == kvImageNoError, "vImageConverter creation failed with error: %zd", converterCreateError);
110
110
111
        vImage_Error converterConvertError = vImageConvert_AnyToAny(converter.get(), &sourceVImageBuffer, &destinationVImageBuffer, nullptr, kvImageNoFlags);
111
        vImage_Error converterConvertError = vImageConvert_AnyToAny(converter.get(), &sourceVImageBuffer, &destinationVImageBuffer, nullptr, kvImageNoFlags);
112
        ASSERT_WITH_MESSAGE_UNUSED(converterConvertError, converterConvertError == kvImageNoError, "vImageConvert_AnyToAny failed conversion with error: %zd", converterConvertError);
112
        ASSERT_WITH_MESSAGE_UNUSED(converterConvertError, converterConvertError == kvImageNoError, "vImageConvert_AnyToAny failed conversion with error: %zd", converterConvertError);
- Source/WebCore/platform/graphics/filters/FilterEffect.cpp -7 / +15 lines
Lines 468-474 Optional<PixelBuffer> FilterEffect::conv Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec1
468
    // Color space conversion happens internally when drawing from one image buffer to another
468
    // Color space conversion happens internally when drawing from one image buffer to another
469
    convertedBuffer->context().drawImageBuffer(inputBuffer, rect);
469
    convertedBuffer->context().drawImageBuffer(inputBuffer, rect);
470
    
470
    
471
    PixelBufferFormat format { outputAlphaFormat, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
471
    PixelBufferFormat format { outputAlphaFormat, PixelFormat::RGBA8, targetColorSpace };
472
    return convertedBuffer->getPixelBuffer(format, rect);
472
    return convertedBuffer->getPixelBuffer(format, rect);
473
}
473
}
474
474
Lines 504-510 void FilterEffect::copyUnmultipliedResul Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec2
504
                copyConvertedImageBufferToDestination(destination, *colorSpace, AlphaPremultiplication::Unpremultiplied, rect);
504
                copyConvertedImageBufferToDestination(destination, *colorSpace, AlphaPremultiplication::Unpremultiplied, rect);
505
                return;
505
                return;
506
            }
506
            }
507
            PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
507
508
            ASSERT(m_imageBufferResult->colorSpace() == m_resultColorSpace);
509
            PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, m_resultColorSpace };
508
            m_unmultipliedImageResult = m_imageBufferResult->getPixelBuffer(format, { IntPoint(), m_absolutePaintRect.size() });
510
            m_unmultipliedImageResult = m_imageBufferResult->getPixelBuffer(format, { IntPoint(), m_absolutePaintRect.size() });
509
            if (!m_unmultipliedImageResult)
511
            if (!m_unmultipliedImageResult)
510
                return;
512
                return;
Lines 512-518 void FilterEffect::copyUnmultipliedResul Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec3
512
            IntSize inputSize(m_absolutePaintRect.size());
514
            IntSize inputSize(m_absolutePaintRect.size());
513
            ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
515
            ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
514
            inputSize.scale(m_filter.filterScale());
516
            inputSize.scale(m_filter.filterScale());
515
            PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
517
            
518
            ASSERT(m_premultipliedImageResult->format().colorSpace == m_resultColorSpace);
519
            PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, m_resultColorSpace };
516
            m_unmultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
520
            m_unmultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
517
            if (!m_unmultipliedImageResult)
521
            if (!m_unmultipliedImageResult)
518
                return;
522
                return;
Lines 539-545 void FilterEffect::copyPremultipliedResu Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec4
539
                copyConvertedImageBufferToDestination(destination, *colorSpace, AlphaPremultiplication::Premultiplied, rect);
543
                copyConvertedImageBufferToDestination(destination, *colorSpace, AlphaPremultiplication::Premultiplied, rect);
540
                return;
544
                return;
541
            }
545
            }
542
            PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
546
547
            ASSERT(m_imageBufferResult->colorSpace() == m_resultColorSpace);
548
            PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, m_resultColorSpace };
543
            m_premultipliedImageResult = m_imageBufferResult->getPixelBuffer(format, { IntPoint(), m_absolutePaintRect.size() });
549
            m_premultipliedImageResult = m_imageBufferResult->getPixelBuffer(format, { IntPoint(), m_absolutePaintRect.size() });
544
            if (!m_premultipliedImageResult)
550
            if (!m_premultipliedImageResult)
545
                return;
551
                return;
Lines 547-553 void FilterEffect::copyPremultipliedResu Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec5
547
            IntSize inputSize(m_absolutePaintRect.size());
553
            IntSize inputSize(m_absolutePaintRect.size());
548
            ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
554
            ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
549
            inputSize.scale(m_filter.filterScale());
555
            inputSize.scale(m_filter.filterScale());
550
            PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
556
557
            ASSERT(m_unmultipliedImageResult->format().colorSpace == m_resultColorSpace);
558
            PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, m_resultColorSpace };
551
            m_premultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
559
            m_premultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
552
            if (!m_premultipliedImageResult)
560
            if (!m_premultipliedImageResult)
553
                return;
561
                return;
Lines 590-596 Optional<PixelBuffer>& FilterEffect::cre Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec6
590
    IntSize resultSize(m_absolutePaintRect.size());
598
    IntSize resultSize(m_absolutePaintRect.size());
591
    ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
599
    ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
592
    resultSize.scale(m_filter.filterScale());
600
    resultSize.scale(m_filter.filterScale());
593
    PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
601
    PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, m_resultColorSpace };
594
    m_unmultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
602
    m_unmultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
595
    return m_unmultipliedImageResult;
603
    return m_unmultipliedImageResult;
596
}
604
}
Lines 609-615 Optional<PixelBuffer>& FilterEffect::cre Source/WebCore/platform/graphics/filters/FilterEffect.cpp_sec7
609
    IntSize resultSize(m_absolutePaintRect.size());
617
    IntSize resultSize(m_absolutePaintRect.size());
610
    ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
618
    ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
611
    resultSize.scale(m_filter.filterScale());
619
    resultSize.scale(m_filter.filterScale());
612
    PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
620
    PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, m_resultColorSpace };
613
    m_premultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
621
    m_premultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
614
    return m_premultipliedImageResult;
622
    return m_premultipliedImageResult;
615
}
623
}
- Source/WebCore/testing/Internals.cpp -2 / +2 lines
Lines 5331-5337 void Internals::videoSampleAvailable(Med Source/WebCore/testing/Internals.cpp_sec1
5331
    if (!rgba)
5331
    if (!rgba)
5332
        return;
5332
        return;
5333
    
5333
    
5334
    auto imageData = ImageData::create(rgba.releaseNonNull(), videoSettings.width(), videoSettings.height());
5334
    auto imageData = ImageData::create(rgba.releaseNonNull(), videoSettings.width(), videoSettings.height(), { { PredefinedColorSpace::SRGB } });
5335
    if (!imageData.hasException())
5335
    if (!imageData.hasException())
5336
        m_nextTrackFramePromise->resolve(imageData.releaseReturnValue());
5336
        m_nextTrackFramePromise->resolve(imageData.releaseReturnValue());
5337
    else
5337
    else
Lines 6203-6209 void Internals::loadArtworkImage(String& Source/WebCore/testing/Internals.cpp_sec2
6203
    m_artworkImagePromise = makeUnique<ArtworkImagePromise>(WTFMove(promise));
6203
    m_artworkImagePromise = makeUnique<ArtworkImagePromise>(WTFMove(promise));
6204
    m_artworkLoader = makeUnique<ArtworkImageLoader>(*contextDocument(), url, [this](Image* image) {
6204
    m_artworkLoader = makeUnique<ArtworkImageLoader>(*contextDocument(), url, [this](Image* image) {
6205
        if (image) {
6205
        if (image) {
6206
            auto imageData = ImageData::create(unsigned(image->width()), unsigned(image->height()));
6206
            auto imageData = ImageData::create(static_cast<unsigned>(image->width()), static_cast<unsigned>(image->height()), { { PredefinedColorSpace::SRGB } });
6207
            if (!imageData.hasException())
6207
            if (!imageData.hasException())
6208
                m_artworkImagePromise->resolve(imageData.releaseReturnValue());
6208
                m_artworkImagePromise->resolve(imageData.releaseReturnValue());
6209
            else
6209
            else
- Source/WebKitLegacy/win/ChangeLog +15 lines
Lines 1-3 Source/WebKitLegacy/win/ChangeLog_sec1
1
2021-05-15  Sam Weinig  <weinig@apple.com>
2
3
        Add support for creating/accessing/setting non-sRGB ImageData via canvas
4
        https://bugs.webkit.org/show_bug.cgi?id=225841
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add support for tests enabling the CanvasColorSpaceEnabled preference.
9
10
        * WebPreferences.cpp:
11
        (WebPreferences::canvasColorSpaceEnable):
12
        * WebPreferences.h:
13
        * WebView.cpp:
14
        (WebView::notifyPreferencesChanged):
15
1
2021-05-14  Chris Dumez  <cdumez@apple.com>
16
2021-05-14  Chris Dumez  <cdumez@apple.com>
2
17
3
        Drop legacy / prefixed WebAudio implementation
18
        Drop legacy / prefixed WebAudio implementation
- Source/WebKitLegacy/win/WebPreferences.cpp +6 lines
Lines 2631-2633 HRESULT WebPreferences::stopBatchingUpda Source/WebKitLegacy/win/WebPreferences.cpp_sec1
2631
    }
2631
    }
2632
    return S_OK;
2632
    return S_OK;
2633
}
2633
}
2634
2635
bool WebPreferences::canvasColorSpaceEnable()
2636
{
2637
    return boolValueForKey("WebKitCanvasColorSpaceBehaviorEnabled");
2638
}
2639
- Source/WebKitLegacy/win/WebPreferences.h +4 lines
Lines 343-348 public: Source/WebKitLegacy/win/WebPreferences.h_sec1
343
343
344
    HRESULT postPreferencesChangesNotification();
344
    HRESULT postPreferencesChangesNotification();
345
345
346
    // The following preference accessors are not exposed via IWebPreferences* as they are only
347
    // needed for testing purposes and can be toggled via the set*PreferenceForTesting functions.
348
    bool canvasColorSpaceEnable();
349
346
private:
350
private:
347
    WebPreferences();
351
    WebPreferences();
348
    ~WebPreferences();
352
    ~WebPreferences();
- Source/WebKitLegacy/win/WebView.cpp +2 lines
Lines 5667-5672 HRESULT WebView::notifyPreferencesChange Source/WebKitLegacy/win/WebView.cpp_sec1
5667
        return hr;
5667
        return hr;
5668
    settings.setOverscrollBehaviorEnabled(!!enabled);
5668
    settings.setOverscrollBehaviorEnabled(!!enabled);
5669
5669
5670
    settings.setCanvasColorSpaceEnabled(canvasColorSpaceEnable());
5671
5670
    return S_OK;
5672
    return S_OK;
5671
}
5673
}
5672
5674
- LayoutTests/ChangeLog +30 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2021-05-15  Sam Weinig  <weinig@apple.com>
2
3
        Add support for creating/accessing/setting non-sRGB ImageData via canvas
4
        https://bugs.webkit.org/show_bug.cgi?id=225841
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * TestExpectations:
9
        Remove wide-gamut-canvas now that they should pass.
10
11
        * fast/canvas/canvas-color-space-display-p3-ImageData-expected.txt: Added.
12
        * fast/canvas/canvas-color-space-display-p3-ImageData.html: Added.
13
        Add new test exercising getImageData and putImageData with non-sRGB canvases
14
        and non-sRGB ImageData.
15
 
16
        * fast/canvas/canvas-imageData-expected.txt:
17
        Update results for updated error messages, which are a bit worse due additional
18
        ambiguity in signatures.
19
20
        * platform/glib/TestExpectations:
21
        Mark new test as failing on glib due to lack of display-p3 support.
22
23
        * platform/win/TestExpectations:
24
        Mark new test as failing on Windows due to lack of display-p3 support.
25
        Unskip CanvasRenderingContext2DSettings-colorSpace-enabled.html which
26
        should now pass due to adding manual preferences support in WebKitLegacy/win. 
27
28
        * storage/indexeddb/modern/objectstore-autoincrement-types-expected.txt:
29
        Update results due to new attribute in ImageData that is auto printed.
30
1
2021-05-15  Said Abou-Hallawa  <said@apple.com>
31
2021-05-15  Said Abou-Hallawa  <said@apple.com>
2
32
3
        Implement CanvasRenderingContext2D.createConicGradient
33
        Implement CanvasRenderingContext2D.createConicGradient
- LayoutTests/TestExpectations -3 lines
Lines 3994-4002 imported/w3c/web-platform-tests/html/can LayoutTests/TestExpectations_sec1
3994
imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height.tentative.html [ ImageOnlyFailure ]
3994
imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height.tentative.html [ ImageOnlyFailure ]
3995
imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/image-orientation/drawImage-from-element.tentative.html [ ImageOnlyFailure ]
3995
imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/image-orientation/drawImage-from-element.tentative.html [ ImageOnlyFailure ]
3996
3996
3997
# Sometimes prints weird output at the beginning of the tests.
3998
imported/w3c/web-platform-tests/html/canvas/element/wide-gamut-canvas [ Failure Pass ]
3999
4000
# CSS Masonry Layout not supported.
3997
# CSS Masonry Layout not supported.
4001
imported/w3c/web-platform-tests/css/css-grid/masonry.tentative [ Skip ]
3998
imported/w3c/web-platform-tests/css/css-grid/masonry.tentative [ Skip ]
4002
webkit.org/b/202115 imported/w3c/web-platform-tests/css/css-grid/subgrid [ Skip ]
3999
webkit.org/b/202115 imported/w3c/web-platform-tests/css/css-grid/subgrid [ Skip ]
- LayoutTests/fast/canvas/canvas-color-space-display-p3-ImageData-expected.txt +159 lines
Line 0 LayoutTests/fast/canvas/canvas-color-space-display-p3-ImageData-expected.txt_sec1
1
Test that pixel access functions work with non-SRGB color spaces.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS imageDataCreatedFromDisplayP3Canvas.colorSpace is "display-p3"
7
PASS imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceSRGB.colorSpace is "srgb"
8
PASS imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceDisplayP3.colorSpace is "display-p3"
9
PASS imageDataCreatedFromSRGBCanvas.colorSpace is "srgb"
10
PASS imageDataCreatedFromSRGBCanvasOverridingColorSpaceSRGB.colorSpace is "srgb"
11
PASS imageDataCreatedFromSRGBCanvasOverridingColorSpaceDisplayP3.colorSpace is "display-p3"
12
PASS imageDataCreatedFromImageDataConstructor.colorSpace is "srgb"
13
PASS imageDataCreatedFromImageDataConstructorSettingColorSpaceToSRGB.colorSpace is "srgb"
14
PASS imageDataCreatedFromImageDataConstructorSettingColorSpaceToDisplayP3.colorSpace is "display-p3"
15
PASS imageDataCreatedFromImageDataConstructorPassingBuffer.colorSpace is "srgb"
16
PASS imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToSRGB.colorSpace is "srgb"
17
PASS imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToDisplayP3.colorSpace is "display-p3"
18
19
Testing a display-p3 canvas with color(display-p3 0 1 0) drawn into it
20
21
Test getImageData with no specified color space, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)
22
PASS data.colorSpace is "display-p3"
23
PASS data.data[0] is 0
24
PASS data.data[1] is 255
25
PASS data.data[2] is 0
26
PASS data.data[3] is 255
27
Test getImageData with srgb specified, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)
28
PASS data.colorSpace is "srgb"
29
PASS data.data[0] is 0
30
PASS data.data[1] is 255
31
PASS data.data[2] is 0
32
PASS data.data[3] is 255
33
Test getImageData with display-p3 specified, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)
34
PASS data.colorSpace is "display-p3"
35
PASS data.data[0] is 0
36
PASS data.data[1] is 255
37
PASS data.data[2] is 0
38
PASS data.data[3] is 255
39
40
Testing a display-p3 canvas with color(srgb 0 1 0) drawn into it
41
42
Test getImageData with no specified color space, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)
43
PASS data.colorSpace is "display-p3"
44
PASS data.data[0] is 117
45
PASS data.data[1] is 251
46
PASS data.data[2] is 76
47
PASS data.data[3] is 255
48
Test getImageData with srgb specified, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)
49
PASS data.colorSpace is "srgb"
50
PASS data.data[0] is 3
51
PASS data.data[1] is 255
52
PASS data.data[2] is 0
53
PASS data.data[3] is 255
54
Test getImageData with display-p3 specified, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)
55
PASS data.colorSpace is "display-p3"
56
PASS data.data[0] is 117
57
PASS data.data[1] is 251
58
PASS data.data[2] is 76
59
PASS data.data[3] is 255
60
61
Testing a srgb canvas with color(display-p3 0 1 0) drawn into it
62
63
Test getImageData with no specified color space, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)
64
PASS data.colorSpace is "srgb"
65
PASS data.data[0] is 0
66
PASS data.data[1] is 255
67
PASS data.data[2] is 0
68
PASS data.data[3] is 255
69
Test getImageData with srgb specified, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)
70
PASS data.colorSpace is "srgb"
71
PASS data.data[0] is 0
72
PASS data.data[1] is 255
73
PASS data.data[2] is 0
74
PASS data.data[3] is 255
75
Test getImageData with display-p3 specified, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)
76
PASS data.colorSpace is "display-p3"
77
PASS data.data[0] is 117
78
PASS data.data[1] is 251
79
PASS data.data[2] is 76
80
PASS data.data[3] is 255
81
82
Testing a srgb canvas with color(srgb-p3 0 1 0) drawn into it
83
84
Test getImageData with no specified color space, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)
85
PASS data.colorSpace is "srgb"
86
PASS data.data[0] is 0
87
PASS data.data[1] is 255
88
PASS data.data[2] is 0
89
PASS data.data[3] is 255
90
Test getImageData with srgb specified, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)
91
PASS data.colorSpace is "srgb"
92
PASS data.data[0] is 0
93
PASS data.data[1] is 255
94
PASS data.data[2] is 0
95
PASS data.data[3] is 255
96
Test getImageData with display-p3 specified, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)
97
PASS data.colorSpace is "display-p3"
98
PASS data.data[0] is 117
99
PASS data.data[1] is 251
100
PASS data.data[2] is 76
101
PASS data.data[3] is 255
102
103
104
Testing a display-p3 canvas with display-p3 ImageData drawn into it
105
106
PASS data.colorSpace is "srgb"
107
PASS data.data[0] is 0
108
PASS data.data[1] is 255
109
PASS data.data[2] is 0
110
PASS data.data[3] is 255
111
PASS data.colorSpace is "display-p3"
112
PASS data.data[0] is 0
113
PASS data.data[1] is 255
114
PASS data.data[2] is 0
115
PASS data.data[3] is 255
116
117
Testing a display-p3 canvas with srgb ImageData drawn into it
118
119
PASS data.colorSpace is "srgb"
120
PASS data.data[0] is 3
121
PASS data.data[1] is 255
122
PASS data.data[2] is 0
123
PASS data.data[3] is 255
124
PASS data.colorSpace is "display-p3"
125
PASS data.data[0] is 117
126
PASS data.data[1] is 251
127
PASS data.data[2] is 76
128
PASS data.data[3] is 255
129
130
Testing a srgb canvas with display-p3 ImageData drawn into it
131
132
PASS data.colorSpace is "srgb"
133
PASS data.data[0] is 0
134
PASS data.data[1] is 255
135
PASS data.data[2] is 0
136
PASS data.data[3] is 255
137
PASS data.colorSpace is "display-p3"
138
PASS data.data[0] is 117
139
PASS data.data[1] is 251
140
PASS data.data[2] is 76
141
PASS data.data[3] is 255
142
143
Testing a srgb canvas with srgb ImageData drawn into it
144
145
PASS data.colorSpace is "srgb"
146
PASS data.data[0] is 0
147
PASS data.data[1] is 255
148
PASS data.data[2] is 0
149
PASS data.data[3] is 255
150
PASS data.colorSpace is "display-p3"
151
PASS data.data[0] is 117
152
PASS data.data[1] is 251
153
PASS data.data[2] is 76
154
PASS data.data[3] is 255
155
156
PASS successfullyParsed is true
157
158
TEST COMPLETE
159
- LayoutTests/fast/canvas/canvas-color-space-display-p3-ImageData.html +290 lines
Line 0 LayoutTests/fast/canvas/canvas-color-space-display-p3-ImageData.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="../../resources/js-test-pre.js"></script>
5
</head>
6
<body>
7
<script>
8
description("Test that pixel access functions work with non-SRGB color spaces.");
9
10
let canvasDisplayP3 = document.createElement("canvas");
11
let contextDisplayP3 = canvasDisplayP3.getContext("2d", { colorSpace: "display-p3" });
12
13
let canvasSRGB = document.createElement("canvas");
14
let contextSRGB = canvasSRGB.getContext("2d", { colorSpace: "srgb" });
15
16
const imageDataCreatedFromDisplayP3Canvas = contextDisplayP3.createImageData(50, 50);
17
shouldBe("imageDataCreatedFromDisplayP3Canvas.colorSpace", `"display-p3"`);
18
19
const imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceSRGB = contextDisplayP3.createImageData(50, 50, { colorSpace: "srgb" });
20
shouldBe("imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceSRGB.colorSpace", `"srgb"`);
21
22
const imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceDisplayP3 = contextDisplayP3.createImageData(50, 50, { colorSpace: "display-p3" });
23
shouldBe("imageDataCreatedFromDisplayP3CanvasOverridingColorSpaceDisplayP3.colorSpace", `"display-p3"`);
24
25
const imageDataCreatedFromSRGBCanvas = contextSRGB.createImageData(50, 50);
26
shouldBe("imageDataCreatedFromSRGBCanvas.colorSpace", `"srgb"`);
27
28
const imageDataCreatedFromSRGBCanvasOverridingColorSpaceSRGB = contextSRGB.createImageData(50, 50, { colorSpace: "srgb" });
29
shouldBe("imageDataCreatedFromSRGBCanvasOverridingColorSpaceSRGB.colorSpace", `"srgb"`);
30
31
const imageDataCreatedFromSRGBCanvasOverridingColorSpaceDisplayP3 = contextSRGB.createImageData(50, 50, { colorSpace: "display-p3" });
32
shouldBe("imageDataCreatedFromSRGBCanvasOverridingColorSpaceDisplayP3.colorSpace", `"display-p3"`);
33
34
const imageDataCreatedFromImageDataConstructor = new ImageData(50, 50, { colorSpace: "srgb" });
35
shouldBe("imageDataCreatedFromImageDataConstructor.colorSpace", `"srgb"`);
36
37
const imageDataCreatedFromImageDataConstructorSettingColorSpaceToSRGB = new ImageData(50, 50, { colorSpace: "srgb" });
38
shouldBe("imageDataCreatedFromImageDataConstructorSettingColorSpaceToSRGB.colorSpace", `"srgb"`);
39
40
const imageDataCreatedFromImageDataConstructorSettingColorSpaceToDisplayP3 = new ImageData(50, 50, { colorSpace: "display-p3" });
41
shouldBe("imageDataCreatedFromImageDataConstructorSettingColorSpaceToDisplayP3.colorSpace", `"display-p3"`);
42
43
const imageDataCreatedFromImageDataConstructorPassingBuffer = new ImageData(new Uint8ClampedArray(400), 10, 10, { colorSpace: "srgb" });
44
shouldBe("imageDataCreatedFromImageDataConstructorPassingBuffer.colorSpace", `"srgb"`);
45
46
const imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToSRGB = new ImageData(new Uint8ClampedArray(400), 10, 10, { colorSpace: "srgb" });
47
shouldBe("imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToSRGB.colorSpace", `"srgb"`);
48
49
const imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToDisplayP3 = new ImageData(new Uint8ClampedArray(400), 10, 10, { colorSpace: "display-p3" });
50
shouldBe("imageDataCreatedFromImageDataConstructorPassingBufferSettingColorSpaceToDisplayP3.colorSpace", `"display-p3"`);
51
52
var data = { };
53
54
// NOTE:
55
// color(srgb 0 1 0) converted to display-p3 is color(display-p3 0.4584 0.98526 0.29829) or [117, 251, 76, 255] in byte form.
56
57
debug("");
58
debug("Testing a display-p3 canvas with color(display-p3 0 1 0) drawn into it");
59
debug("");
60
61
contextDisplayP3.fillStyle = "color(display-p3 0 1 0)";
62
contextDisplayP3.fillRect(0, 0, 50, 50);
63
64
// No specified color space will default to the canvas' color space, in this case, display-p3
65
debug("Test getImageData with no specified color space, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)");
66
data = contextDisplayP3.getImageData(0, 0, 1, 1);
67
shouldBe("data.colorSpace", `"display-p3"`)
68
shouldBe("data.data[0]", "0");
69
shouldBe("data.data[1]", "255");
70
shouldBe("data.data[2]", "0");
71
shouldBe("data.data[3]", "255");
72
73
debug("Test getImageData with srgb specified, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)");
74
// NOTE: color(display-p3 0 1 0) is outside the range of sRGB, so it clipped to 255.
75
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
76
shouldBe("data.colorSpace", `"srgb"`)
77
shouldBe("data.data[0]", "0");
78
shouldBe("data.data[1]", "255");
79
shouldBe("data.data[2]", "0");
80
shouldBe("data.data[3]", "255");
81
82
debug("Test getImageData with display-p3 specified, on a display-p3 canvas (canvas has color(display-p3 0 1 0) drawn in it)");
83
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
84
shouldBe("data.colorSpace", `"display-p3"`)
85
shouldBe("data.data[0]", "0");
86
shouldBe("data.data[1]", "255");
87
shouldBe("data.data[2]", "0");
88
shouldBe("data.data[3]", "255");
89
90
debug("");
91
debug("Testing a display-p3 canvas with color(srgb 0 1 0) drawn into it");
92
debug("");
93
94
contextDisplayP3.fillStyle = "color(srgb 0 1 0)";
95
contextDisplayP3.fillRect(0, 0, 50, 50);
96
97
// No specified color space will default to the canvas' color space, in this case, display-p3
98
debug("Test getImageData with no specified color space, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)");
99
data = contextDisplayP3.getImageData(0, 0, 1, 1);
100
shouldBe("data.colorSpace", `"display-p3"`)
101
shouldBe("data.data[0]", "117");
102
shouldBe("data.data[1]", "251");
103
shouldBe("data.data[2]", "76");
104
shouldBe("data.data[3]", "255");
105
106
debug("Test getImageData with srgb specified, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)");
107
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
108
shouldBe("data.colorSpace", `"srgb"`)
109
// NOTE: This 3 is odd, but due to lack of precision in 8-bit round-tripping.
110
shouldBe("data.data[0]", "3");
111
shouldBe("data.data[1]", "255");
112
shouldBe("data.data[2]", "0");
113
shouldBe("data.data[3]", "255");
114
115
debug("Test getImageData with display-p3 specified, on a display-p3 canvas (canvas has color(srgb 0 1 0) drawn in it)");
116
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
117
shouldBe("data.colorSpace", `"display-p3"`)
118
shouldBe("data.data[0]", "117");
119
shouldBe("data.data[1]", "251");
120
shouldBe("data.data[2]", "76");
121
shouldBe("data.data[3]", "255");
122
123
debug("");
124
debug("Testing a srgb canvas with color(display-p3 0 1 0) drawn into it");
125
debug("");
126
127
contextSRGB.fillStyle = "color(display-p3 0 1 0)";
128
contextSRGB.fillRect(0, 0, 50, 50);
129
130
// No specified color space will default to the canvas' color space, in this case, srgb
131
debug("Test getImageData with no specified color space, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)");
132
data = contextSRGB.getImageData(0, 0, 1, 1);
133
shouldBe("data.colorSpace", `"srgb"`)
134
shouldBe("data.data[0]", "0");
135
shouldBe("data.data[1]", "255");
136
shouldBe("data.data[2]", "0");
137
shouldBe("data.data[3]", "255");
138
139
debug("Test getImageData with srgb specified, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)");
140
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
141
shouldBe("data.colorSpace", `"srgb"`)
142
shouldBe("data.data[0]", "0");
143
shouldBe("data.data[1]", "255");
144
shouldBe("data.data[2]", "0");
145
shouldBe("data.data[3]", "255");
146
147
debug("Test getImageData with display-p3 specified, on a srgb canvas (canvas has color(display-p3 0 1 0) drawn in it)");
148
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
149
shouldBe("data.colorSpace", `"display-p3"`)
150
shouldBe("data.data[0]", "117");
151
shouldBe("data.data[1]", "251");
152
shouldBe("data.data[2]", "76");
153
shouldBe("data.data[3]", "255");
154
155
debug("");
156
debug("Testing a srgb canvas with color(srgb-p3 0 1 0) drawn into it");
157
debug("");
158
159
contextSRGB.fillStyle = "color(srgb 0 1 0)";
160
contextSRGB.fillRect(0, 0, 50, 50);
161
162
// No specified color space will default to the canvas' color space, in this case, srgb
163
debug("Test getImageData with no specified color space, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)");
164
data = contextSRGB.getImageData(0, 0, 1, 1);
165
shouldBe("data.colorSpace", `"srgb"`)
166
shouldBe("data.data[0]", "0");
167
shouldBe("data.data[1]", "255");
168
shouldBe("data.data[2]", "0");
169
shouldBe("data.data[3]", "255");
170
171
debug("Test getImageData with srgb specified, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)");
172
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
173
shouldBe("data.colorSpace", `"srgb"`)
174
shouldBe("data.data[0]", "0");
175
shouldBe("data.data[1]", "255");
176
shouldBe("data.data[2]", "0");
177
shouldBe("data.data[3]", "255");
178
179
debug("Test getImageData with display-p3 specified, on a srgb canvas (canvas has color(srgb 0 1 0) drawn in it)");
180
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
181
shouldBe("data.colorSpace", `"display-p3"`)
182
shouldBe("data.data[0]", "117");
183
shouldBe("data.data[1]", "251");
184
shouldBe("data.data[2]", "76");
185
shouldBe("data.data[3]", "255");
186
187
188
debug("");
189
190
191
const imageDataDisplayP3ToPut = new ImageData(1, 1, { colorSpace: "display-p3" });
192
imageDataDisplayP3ToPut.data[0] = 0;
193
imageDataDisplayP3ToPut.data[1] = 255;
194
imageDataDisplayP3ToPut.data[2] = 0;
195
imageDataDisplayP3ToPut.data[3] = 255;
196
197
const imageDataSRGBToPut = new ImageData(1, 1, { colorSpace: "srgb" });
198
imageDataSRGBToPut.data[0] = 0;
199
imageDataSRGBToPut.data[1] = 255;
200
imageDataSRGBToPut.data[2] = 0;
201
imageDataSRGBToPut.data[3] = 255;
202
203
204
debug("");
205
debug("Testing a display-p3 canvas with display-p3 ImageData drawn into it");
206
debug("");
207
208
contextDisplayP3.putImageData(imageDataDisplayP3ToPut, 0, 0);
209
210
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
211
shouldBe("data.colorSpace", `"srgb"`)
212
shouldBe("data.data[0]", "0");
213
shouldBe("data.data[1]", "255");
214
shouldBe("data.data[2]", "0");
215
shouldBe("data.data[3]", "255");
216
217
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
218
shouldBe("data.colorSpace", `"display-p3"`)
219
shouldBe("data.data[0]", "0");
220
shouldBe("data.data[1]", "255");
221
shouldBe("data.data[2]", "0");
222
shouldBe("data.data[3]", "255");
223
224
debug("");
225
debug("Testing a display-p3 canvas with srgb ImageData drawn into it");
226
debug("");
227
228
contextDisplayP3.putImageData(imageDataSRGBToPut, 0, 0);
229
230
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
231
shouldBe("data.colorSpace", `"srgb"`)
232
// NOTE: This 3 is odd, but due to lack of precision in 8-bit round-tripping.
233
shouldBe("data.data[0]", "3");
234
shouldBe("data.data[1]", "255");
235
shouldBe("data.data[2]", "0");
236
shouldBe("data.data[3]", "255");
237
238
data = contextDisplayP3.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
239
shouldBe("data.colorSpace", `"display-p3"`)
240
shouldBe("data.data[0]", "117");
241
shouldBe("data.data[1]", "251");
242
shouldBe("data.data[2]", "76");
243
shouldBe("data.data[3]", "255");
244
245
debug("");
246
debug("Testing a srgb canvas with display-p3 ImageData drawn into it");
247
debug("");
248
249
contextSRGB.putImageData(imageDataDisplayP3ToPut, 0, 0);
250
251
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
252
shouldBe("data.colorSpace", `"srgb"`)
253
shouldBe("data.data[0]", "0");
254
shouldBe("data.data[1]", "255");
255
shouldBe("data.data[2]", "0");
256
shouldBe("data.data[3]", "255");
257
258
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
259
shouldBe("data.colorSpace", `"display-p3"`)
260
shouldBe("data.data[0]", "117");
261
shouldBe("data.data[1]", "251");
262
shouldBe("data.data[2]", "76");
263
shouldBe("data.data[3]", "255");
264
265
266
debug("");
267
debug("Testing a srgb canvas with srgb ImageData drawn into it");
268
debug("");
269
270
contextSRGB.putImageData(imageDataSRGBToPut, 0, 0);
271
272
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
273
shouldBe("data.colorSpace", `"srgb"`)
274
shouldBe("data.data[0]", "0");
275
shouldBe("data.data[1]", "255");
276
shouldBe("data.data[2]", "0");
277
shouldBe("data.data[3]", "255");
278
279
data = contextSRGB.getImageData(0, 0, 1, 1, { colorSpace: "display-p3" });
280
shouldBe("data.colorSpace", `"display-p3"`)
281
shouldBe("data.data[0]", "117");
282
shouldBe("data.data[1]", "251");
283
shouldBe("data.data[2]", "76");
284
shouldBe("data.data[3]", "255");
285
286
debug("");
287
</script>
288
<script src="../../resources/js-test-post.js"></script>
289
</body>
290
</html>
- LayoutTests/fast/canvas/canvas-imageData-expected.txt -9 / +9 lines
Lines 14-33 PASS new ImageData(-20, 20) threw except LayoutTests/fast/canvas/canvas-imageData-expected.txt_sec1
14
PASS new ImageData(20, -20) threw exception RangeError: Cannot allocate a buffer of this size.
14
PASS new ImageData(20, -20) threw exception RangeError: Cannot allocate a buffer of this size.
15
PASS new ImageData(null, 20) threw exception IndexSizeError: The index is not in the allowed range..
15
PASS new ImageData(null, 20) threw exception IndexSizeError: The index is not in the allowed range..
16
PASS new ImageData(32768, 32768) threw exception RangeError: Cannot allocate a buffer of this size.
16
PASS new ImageData(32768, 32768) threw exception RangeError: Cannot allocate a buffer of this size.
17
PASS new ImageData(null, 20, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
17
PASS new ImageData(null, 20, 20) threw exception TypeError: Type error.
18
PASS new ImageData(imageData, 20, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
18
PASS new ImageData(imageData, 20, 20) threw exception TypeError: Type error.
19
PASS new ImageData(imageData, 0) threw exception IndexSizeError: The index is not in the allowed range..
19
PASS new ImageData(imageData, 0) threw exception IndexSizeError: The index is not in the allowed range..
20
PASS new ImageData(imageData, 20, 0) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
20
PASS new ImageData(imageData, 20, 0) threw exception TypeError: Type error.
21
PASS new ImageData(imageData, 0, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
21
PASS new ImageData(imageData, 0, 20) threw exception TypeError: Type error.
22
PASS new ImageData(imageData, 10, 5) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
22
PASS new ImageData(imageData, 10, 5) threw exception TypeError: Type error.
23
PASS new ImageData(imageData.data, 10, 5) threw exception IndexSizeError: sh value is not equal to height.
23
PASS new ImageData(imageData.data, 10, 5) threw exception IndexSizeError: sh value is not equal to height.
24
PASS new ImageData(imageData.data, -10, 5) threw exception IndexSizeError: Length is not a multiple of sw.
24
PASS new ImageData(imageData.data, -10, 5) threw exception IndexSizeError: Length is not a multiple of sw.
25
PASS new ImageData(imageData.data, 10, -10) threw exception IndexSizeError: sh value is not equal to height.
25
PASS new ImageData(imageData.data, 10, -10) threw exception IndexSizeError: sh value is not equal to height.
26
PASS new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),536870913,2); threw exception IndexSizeError: Length is not a multiple of sw.
26
PASS new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),536870913,2); threw exception IndexSizeError: Length is not a multiple of sw.
27
PASS new ImageData({},2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
27
PASS new ImageData({},2,2); threw exception TypeError: Type error.
28
PASS new ImageData(undefined,2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
28
PASS new ImageData(undefined,2,2); threw exception TypeError: Type error.
29
PASS new ImageData("none",2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
29
PASS new ImageData("none",2,2); threw exception TypeError: Type error.
30
PASS new ImageData(0,2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
30
PASS new ImageData(0,2,2); threw exception TypeError: Type error.
31
PASS new ImageData(imageData.data, 32768, 32768) threw exception IndexSizeError: Length is not a multiple of sw.
31
PASS new ImageData(imageData.data, 32768, 32768) threw exception IndexSizeError: Length is not a multiple of sw.
32
PASS new ImageData(imageData.data, Infinity, Infinity) threw exception IndexSizeError: Length is not a multiple of sw.
32
PASS new ImageData(imageData.data, Infinity, Infinity) threw exception IndexSizeError: Length is not a multiple of sw.
33
PASS new ImageData(imageData.data, NaN, NaN) threw exception IndexSizeError: Length is not a multiple of sw.
33
PASS new ImageData(imageData.data, NaN, NaN) threw exception IndexSizeError: Length is not a multiple of sw.
- LayoutTests/imported/w3c/ChangeLog +10 lines
Lines 1-3 LayoutTests/imported/w3c/ChangeLog_sec1
1
2021-05-15  Sam Weinig  <weinig@apple.com>
2
3
        Add support for creating/accessing/setting non-sRGB ImageData via canvas
4
        https://bugs.webkit.org/show_bug.cgi?id=225841
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3-expected.txt:
9
        Update result to passing.
10
1
2021-05-14  Darin Adler  <darin@apple.com>
11
2021-05-14  Darin Adler  <darin@apple.com>
2
12
3
        output element doesn't react properly to node tree mutations
13
        output element doesn't react properly to node tree mutations
- LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3-expected.txt -1 / +1 lines
Lines 2-6 LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3-expected.txt_sec1
2
test getImageData with display-p3 and uint8 from display p3 uint8 canvas
2
test getImageData with display-p3 and uint8 from display p3 uint8 canvas
3
Actual output:
3
Actual output:
4
4
5
FAIL test getImageData with display-p3 and uint8 from display p3 uint8 canvas assert_approx_equals: expected 62 +/- 2 but got 50
5
PASS test getImageData with display-p3 and uint8 from display p3 uint8 canvas
6
6
- LayoutTests/platform/glib/TestExpectations +1 lines
Lines 2358-2363 fast/replaced/pdf-as-embed-with-no-mime- LayoutTests/platform/glib/TestExpectations_sec1
2358
webkit.org/b/224112 media/video-as-img-output-pts.html [ Timeout Pass ]
2358
webkit.org/b/224112 media/video-as-img-output-pts.html [ Timeout Pass ]
2359
2359
2360
webkit.org/b/225423 fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
2360
webkit.org/b/225423 fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
2361
webkit.org/b/225423 fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
2361
webkit.org/b/225423 fast/canvas/canvas-composite-text-alpha.html [ Failure ]
2362
webkit.org/b/225423 fast/canvas/canvas-composite-text-alpha.html [ Failure ]
2362
2363
2363
# Failing after r277073.
2364
# Failing after r277073.
- LayoutTests/platform/win/TestExpectations -1 / +2 lines
Lines 4633-4636 webexposed/counter-style-image-symbols-n LayoutTests/platform/win/TestExpectations_sec1
4633
4633
4634
fast/text/line-break-with-locale.html [ ImageOnlyFailure ]
4634
fast/text/line-break-with-locale.html [ ImageOnlyFailure ]
4635
4635
4636
fast/canvas/CanvasRenderingContext2DSettings-colorSpace-enabled.html [ Skip ]
4636
# Non-SRGB color spaces are not currently supported by the Windows port.
4637
fast/canvas/canvas-color-space-display-p3-ImageData.html [ Skip ]
- LayoutTests/storage/indexeddb/modern/objectstore-autoincrement-types-expected.txt +2 lines
Lines 26-31 PASS key is 3 LayoutTests/storage/indexeddb/modern/objectstore-autoincrement-types-expected.txt_sec1
26
PASS request.result.primaryKey is imageData.primaryKey
26
PASS request.result.primaryKey is imageData.primaryKey
27
PASS request.result.width is imageData.width
27
PASS request.result.width is imageData.width
28
PASS request.result.height is imageData.height
28
PASS request.result.height is imageData.height
29
PASS request.result.colorSpace is imageData.colorSpace
29
PASS key is 4
30
PASS key is 4
30
PASS request.result.primaryKey is fileList.primaryKey
31
PASS request.result.primaryKey is fileList.primaryKey
31
PASS request.result.length is fileList.length
32
PASS request.result.length is fileList.length
Lines 40-45 PASS request.result[1].type is file.type LayoutTests/storage/indexeddb/modern/objectstore-autoincrement-types-expected.txt_sec2
40
PASS request.result[2].primaryKey is imageData.primaryKey
41
PASS request.result[2].primaryKey is imageData.primaryKey
41
PASS request.result[2].width is imageData.width
42
PASS request.result[2].width is imageData.width
42
PASS request.result[2].height is imageData.height
43
PASS request.result[2].height is imageData.height
44
PASS request.result[2].colorSpace is imageData.colorSpace
43
PASS request.result[3].primaryKey is fileList.primaryKey
45
PASS request.result[3].primaryKey is fileList.primaryKey
44
PASS request.result[3].length is fileList.length
46
PASS request.result[3].length is fileList.length
45
PASS successfullyParsed is true
47
PASS successfullyParsed is true

Return to Bug 225841