Title: [267645] trunk
Revision
267645
Author
wenson_hs...@apple.com
Date
2020-09-26 19:48:39 -0700 (Sat, 26 Sep 2020)

Log Message

Remove support for setting CMYKA fill and stroke colors in 2D canvas
https://bugs.webkit.org/show_bug.cgi?id=217002

Reviewed by Darin Adler.

Source/WebCore:

Remove support for `setFillColor(c, m, y, k, a)` and `setStrokeColor(c, m, y, k, a)` on
`CanvasRenderingContext2D`, which was initially introduced in 2004 with <https://trac.webkit.org/r6730>.
Setting colors from CMYKA components is non-standard and unsupported in both Firefox and Chrome;
importantly, this is implemented in `CanvasStyle::applyStrokeColor` by calling directly into CoreGraphics
API using the platform `CGContextRef`, which is null when using the GPU Process; this subsequently causes
the web process to crash.

In lieu of adding new DisplayList items to support setting fill and stroke colors with CMYKA components,
we can take this opportunity to just drop support for this canvas API entirely. Fixes the following tests
when using the GPU Process to render canvas:
- fast/canvas/canvas-color-serialization.html
- fast/canvas/canvas-overloads-setFillColor.html
- fast/canvas/canvas-overloads-setStrokeColor.html

* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/CanvasRenderingContext2DBase.cpp:
* html/canvas/CanvasStyle.cpp:
(WebCore::CanvasStyle::isEquivalentColor const):
(WebCore::CanvasStyle::applyStrokeColor const):
(WebCore::CanvasStyle::applyFillColor const):
* html/canvas/CanvasStyle.h:
(WebCore::CanvasStyle::color const):

LayoutTests:

Remove calls to `CanvasRenderingContext2D.setFillColor(c, m, y, k, a)` and
`CanvasRenderingContext2D.setStrokeColor(c, m, y, k, a)` in these layout tests.

* fast/canvas/canvas-color-serialization-expected.txt:
* fast/canvas/canvas-color-serialization.html:
* fast/canvas/set-colors-expected.txt:
* fast/canvas/set-colors.html:
* inspector/canvas/recording-2d-full-expected.txt:
* inspector/canvas/resources/recording-2d.js:
* platform/ios/fast/canvas/set-colors-expected.txt:
* platform/mac/fast/canvas/set-colors-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267644 => 267645)


--- trunk/LayoutTests/ChangeLog	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/ChangeLog	2020-09-27 02:48:39 UTC (rev 267645)
@@ -1,3 +1,22 @@
+2020-09-26  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Remove support for setting CMYKA fill and stroke colors in 2D canvas
+        https://bugs.webkit.org/show_bug.cgi?id=217002
+
+        Reviewed by Darin Adler.
+
+        Remove calls to `CanvasRenderingContext2D.setFillColor(c, m, y, k, a)` and
+        `CanvasRenderingContext2D.setStrokeColor(c, m, y, k, a)` in these layout tests.
+
+        * fast/canvas/canvas-color-serialization-expected.txt:
+        * fast/canvas/canvas-color-serialization.html:
+        * fast/canvas/set-colors-expected.txt:
+        * fast/canvas/set-colors.html:
+        * inspector/canvas/recording-2d-full-expected.txt:
+        * inspector/canvas/resources/recording-2d.js:
+        * platform/ios/fast/canvas/set-colors-expected.txt:
+        * platform/mac/fast/canvas/set-colors-expected.txt:
+
 2020-09-26  Darin Adler  <da...@apple.com>
 
         Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many)

Modified: trunk/LayoutTests/fast/canvas/canvas-color-serialization-expected.txt (267644 => 267645)


--- trunk/LayoutTests/fast/canvas/canvas-color-serialization-expected.txt	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/fast/canvas/canvas-color-serialization-expected.txt	2020-09-27 02:48:39 UTC (rev 267645)
@@ -24,24 +24,6 @@
 PASS trySettingFillColorRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
 PASS trySettingStrokeColorRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
 PASS trySettingShadowRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
-PASS trySettingFillColorCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
-PASS trySettingStrokeColorCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
-PASS trySettingShadowCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
-PASS trySettingFillColorCMYKA(0, 0, 0, 0, 1) is '#ffffff'
-PASS trySettingStrokeColorCMYKA(0, 0, 0, 0, 1) is '#ffffff'
-PASS trySettingShadowCMYKA(0, 0, 0, 0, 1) is '#ffffff'
-PASS trySettingFillColorCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
-PASS trySettingStrokeColorCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
-PASS trySettingShadowCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
-PASS trySettingFillColorCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
-PASS trySettingStrokeColorCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
-PASS trySettingShadowCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
-PASS trySettingFillColorCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
-PASS trySettingStrokeColorCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
-PASS trySettingShadowCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
-PASS trySettingFillColorCMYKA(0, 0, 0, 1, 1) is '#000000'
-PASS trySettingStrokeColorCMYKA(0, 0, 0, 1, 1) is '#000000'
-PASS trySettingShadowCMYKA(0, 0, 0, 1, 1) is '#000000'
 PASS trySettingFillColorGrayLevel(0) is '#000000'
 PASS trySettingStrokeColorGrayLevel(0) is '#000000'
 PASS trySettingShadowGrayLevel(0) is '#000000'

Modified: trunk/LayoutTests/fast/canvas/canvas-color-serialization.html (267644 => 267645)


--- trunk/LayoutTests/fast/canvas/canvas-color-serialization.html	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/fast/canvas/canvas-color-serialization.html	2020-09-27 02:48:39 UTC (rev 267645)
@@ -81,30 +81,6 @@
     shouldBe("trySettingShadowRGBA(" + r + ", " + g + ", " + b + ", " + a + ")", expected);
 }
 
-function trySettingFillColorCMYKA(c, m, y, k, a) {
-    ctx.fillStyle = '#666';
-    ctx.setFillColor(c, m, y, k, a);
-    return ctx.fillStyle;
-}
-
-function trySettingStrokeColorCMYKA(c, m, y, k, a) {
-    ctx.strokeStyle = '#666';
-    ctx.setStrokeColor(c, m, y, k, a);
-    return ctx.strokeStyle;
-}
-
-function trySettingShadowCMYKA(c, m, y, k, a) {
-    ctx.strokeStyle = '#666';
-    ctx.setStrokeColor(c, m, y, k, a);
-    return ctx.strokeStyle;
-}
-
-function trySettingCMYKA(c, m, y, k, a, expected) {
-    shouldBe("trySettingFillColorCMYKA(" + c + ", " + m + ", " + y + ", " + k + ", " + a + ")", expected);
-    shouldBe("trySettingStrokeColorCMYKA(" + c + ", " + m + ", " + y + ", " + k + ", " + a + ")", expected);
-    shouldBe("trySettingShadowCMYKA(" + c + ", " + m + ", " + y + ", " + k + ", " + a + ")", expected);
-}
-
 function trySettingFillColorWithOverrideAlpha(color, alpha) {
     ctx.fillStyle = '#666';
     ctx.setFillColor(color, alpha);
@@ -199,13 +175,6 @@
 trySettingRGBA(255, 0, 0, 0.0, "'rgba(255, 0, 0, 0)'");
 trySettingRGBA(255, 0, 0, 0.4, "'rgba(255, 0, 0, 0.4)'");
 
-trySettingCMYKA(0, 0, 0, 0, 0.0, "'rgba(255, 255, 255, 0)'");
-trySettingCMYKA(0, 0, 0, 0, 1.0, "'#ffffff'");
-trySettingCMYKA(0, 1, 0, 0, 0.0, "'rgba(255, 0, 255, 0)'");
-trySettingCMYKA(0, 1, 0, 0, 1.0, "'#ff00ff'");
-trySettingCMYKA(0, 0, 0, 1, 0.0, "'rgba(0, 0, 0, 0)'");
-trySettingCMYKA(0, 0, 0, 1, 1.0, "'#000000'");
-
 trySettingGrayLevel(0.0, "'#000000'");
 trySettingGrayLevel(0.5, "'#808080'");
 trySettingGrayLevel(1.0, "'#ffffff'");

Modified: trunk/LayoutTests/fast/canvas/set-colors-expected.txt (267644 => 267645)


--- trunk/LayoutTests/fast/canvas/set-colors-expected.txt	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/fast/canvas/set-colors-expected.txt	2020-09-27 02:48:39 UTC (rev 267645)
@@ -31,9 +31,6 @@
 PASS testSetFillColor('1, 0.8') is translucentWhite
 PASS testSetFillColor('0, 1, 0, 1') is green
 PASS testSetFillColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetFillColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #000000.
-FAIL testSetFillColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(0, 0, 0, 0.8).
-PASS testSetFillColor('0, 0, 0, 1, 0') is transparent
 PASS testStrokeStyle('transparent') is transparent
 PASS testStrokeStyle('blue') is blue
 PASS testStrokeStyle('#FF0000') is red
@@ -62,9 +59,6 @@
 PASS testSetStrokeColor('1, 0.8') is translucentWhite
 PASS testSetStrokeColor('0, 1, 0, 1') is green
 PASS testSetStrokeColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetStrokeColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #000000.
-FAIL testSetStrokeColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(0, 0, 0, 0.8).
-PASS testSetStrokeColor('0, 0, 0, 1, 0') is transparent
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/canvas/set-colors.html (267644 => 267645)


--- trunk/LayoutTests/fast/canvas/set-colors.html	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/fast/canvas/set-colors.html	2020-09-27 02:48:39 UTC (rev 267645)
@@ -132,9 +132,6 @@
 shouldBe("testSetFillColor('1, 0.8')", "translucentWhite");
 shouldBe("testSetFillColor('0, 1, 0, 1')", "green");
 shouldBe("testSetFillColor('0, 1, 0, 0.8')", "translucentGreen");
-shouldBe("testSetFillColor('0, 0, 0, 1, 1')", "'#1a1a1a'");                   // This test is expected to fail on older versions of Mac OS X.
-shouldBe("testSetFillColor('0, 0, 0, 1, 0.8')", "'rgba(25, 25, 25, 0.8)'");   // Ditto.
-shouldBe("testSetFillColor('0, 0, 0, 1, 0')", "transparent");
 shouldBe("testStrokeStyle('transparent')", "transparent");
 shouldBe("testStrokeStyle('blue')", "blue");
 shouldBe("testStrokeStyle('#FF0000')", "red");
@@ -163,9 +160,6 @@
 shouldBe("testSetStrokeColor('1, 0.8')", "translucentWhite");
 shouldBe("testSetStrokeColor('0, 1, 0, 1')", "green");
 shouldBe("testSetStrokeColor('0, 1, 0, 0.8')", "translucentGreen");
-shouldBe("testSetStrokeColor('0, 0, 0, 1, 1')", "'#1a1a1a'");                  // This test is expected to fail on older versions of Mac OS X.
-shouldBe("testSetStrokeColor('0, 0, 0, 1, 0.8')", "'rgba(25, 25, 25, 0.8)'");  // Ditto.
-shouldBe("testSetStrokeColor('0, 0, 0, 1, 0')", "transparent");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/inspector/canvas/recording-2d-full-expected.txt (267644 => 267645)


--- trunk/LayoutTests/inspector/canvas/recording-2d-full-expected.txt	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/inspector/canvas/recording-2d-full-expected.txt	2020-09-27 02:48:39 UTC (rev 267645)
@@ -695,12 +695,6 @@
         0: setFillColor
         1: (anonymous function)
         2: executeFrameFunction
-    5: setFillColor(9, 10, 11, 12, 13)
-      swizzleTypes: [Number, Number, Number, Number, Number]
-      trace:
-        0: setFillColor
-        1: (anonymous function)
-        2: executeFrameFunction
   50: (duration)
     0: setLineCap("")
       swizzleTypes: [String]
@@ -828,12 +822,6 @@
         0: setStrokeColor
         1: (anonymous function)
         2: executeFrameFunction
-    5: setStrokeColor(9, 10, 11, 12, 13)
-      swizzleTypes: [Number, Number, Number, Number, Number]
-      trace:
-        0: setStrokeColor
-        1: (anonymous function)
-        2: executeFrameFunction
   57: (duration)
     0: setTransform(1, 2, 3, 4, 5, 6)
       swizzleTypes: [Number, Number, Number, Number, Number, Number]

Modified: trunk/LayoutTests/inspector/canvas/resources/recording-2d.js (267644 => 267645)


--- trunk/LayoutTests/inspector/canvas/resources/recording-2d.js	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/inspector/canvas/resources/recording-2d.js	2020-09-27 02:48:39 UTC (rev 267645)
@@ -273,7 +273,6 @@
             ctx.setFillColor(2);
             ctx.setFillColor(3, 4);
             ctx.setFillColor(5, 6, 7, 8);
-            ctx.setFillColor(9, 10, 11, 12, 13);
         },
         () => {
             ctx.setLineCap();
@@ -308,7 +307,6 @@
             ctx.setStrokeColor(2);
             ctx.setStrokeColor(3, 4);
             ctx.setStrokeColor(5, 6, 7, 8);
-            ctx.setStrokeColor(9, 10, 11, 12, 13);
         },
         () => {
             ctx.setTransform(1, 2, 3, 4, 5, 6);

Modified: trunk/LayoutTests/platform/ios/fast/canvas/set-colors-expected.txt (267644 => 267645)


--- trunk/LayoutTests/platform/ios/fast/canvas/set-colors-expected.txt	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/platform/ios/fast/canvas/set-colors-expected.txt	2020-09-27 02:48:39 UTC (rev 267645)
@@ -31,9 +31,6 @@
 PASS testSetFillColor('1, 0.8') is translucentWhite
 PASS testSetFillColor('0, 1, 0, 1') is green
 PASS testSetFillColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetFillColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #1a1919.
-FAIL testSetFillColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(26, 25, 25, 0.8).
-PASS testSetFillColor('0, 0, 0, 1, 0') is transparent
 PASS testStrokeStyle('transparent') is transparent
 PASS testStrokeStyle('blue') is blue
 PASS testStrokeStyle('#FF0000') is red
@@ -62,9 +59,6 @@
 PASS testSetStrokeColor('1, 0.8') is translucentWhite
 PASS testSetStrokeColor('0, 1, 0, 1') is green
 PASS testSetStrokeColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetStrokeColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #1a1919.
-FAIL testSetStrokeColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(26, 25, 25, 0.8).
-PASS testSetStrokeColor('0, 0, 0, 1, 0') is transparent
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/fast/canvas/set-colors-expected.txt (267644 => 267645)


--- trunk/LayoutTests/platform/mac/fast/canvas/set-colors-expected.txt	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/LayoutTests/platform/mac/fast/canvas/set-colors-expected.txt	2020-09-27 02:48:39 UTC (rev 267645)
@@ -31,9 +31,6 @@
 PASS testSetFillColor('1, 0.8') is translucentWhite
 PASS testSetFillColor('0, 1, 0, 1') is green
 PASS testSetFillColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetFillColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #1a1919.
-FAIL testSetFillColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(26, 25, 25, 0.8).
-PASS testSetFillColor('0, 0, 0, 1, 0') is transparent
 PASS testStrokeStyle('transparent') is transparent
 PASS testStrokeStyle('blue') is blue
 PASS testStrokeStyle('#FF0000') is red
@@ -62,9 +59,6 @@
 PASS testSetStrokeColor('1, 0.8') is translucentWhite
 PASS testSetStrokeColor('0, 1, 0, 1') is green
 PASS testSetStrokeColor('0, 1, 0, 0.8') is translucentGreen
-FAIL testSetStrokeColor('0, 0, 0, 1, 1') should be #1a1a1a. Was #1a1919.
-FAIL testSetStrokeColor('0, 0, 0, 1, 0.8') should be rgba(25, 25, 25, 0.8). Was rgba(26, 25, 25, 0.8).
-PASS testSetStrokeColor('0, 0, 0, 1, 0') is transparent
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (267644 => 267645)


--- trunk/Source/WebCore/ChangeLog	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/Source/WebCore/ChangeLog	2020-09-27 02:48:39 UTC (rev 267645)
@@ -1,3 +1,33 @@
+2020-09-26  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Remove support for setting CMYKA fill and stroke colors in 2D canvas
+        https://bugs.webkit.org/show_bug.cgi?id=217002
+
+        Reviewed by Darin Adler.
+
+        Remove support for `setFillColor(c, m, y, k, a)` and `setStrokeColor(c, m, y, k, a)` on
+        `CanvasRenderingContext2D`, which was initially introduced in 2004 with <https://trac.webkit.org/r6730>.
+        Setting colors from CMYKA components is non-standard and unsupported in both Firefox and Chrome;
+        importantly, this is implemented in `CanvasStyle::applyStrokeColor` by calling directly into CoreGraphics
+        API using the platform `CGContextRef`, which is null when using the GPU Process; this subsequently causes
+        the web process to crash.
+
+        In lieu of adding new DisplayList items to support setting fill and stroke colors with CMYKA components,
+        we can take this opportunity to just drop support for this canvas API entirely. Fixes the following tests
+        when using the GPU Process to render canvas:
+        - fast/canvas/canvas-color-serialization.html
+        - fast/canvas/canvas-overloads-setFillColor.html
+        - fast/canvas/canvas-overloads-setStrokeColor.html
+
+        * html/canvas/CanvasRenderingContext2D.idl:
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        * html/canvas/CanvasStyle.cpp:
+        (WebCore::CanvasStyle::isEquivalentColor const):
+        (WebCore::CanvasStyle::applyStrokeColor const):
+        (WebCore::CanvasStyle::applyFillColor const):
+        * html/canvas/CanvasStyle.h:
+        (WebCore::CanvasStyle::color const):
+
 2020-09-26  Chris Dumez  <cdu...@apple.com>
 
         Constructing an AudioNode for a closed context should not throw an exception

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (267644 => 267645)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2020-09-27 02:48:39 UTC (rev 267645)
@@ -46,11 +46,9 @@
     undefined setStrokeColor(DOMString color, optional unrestricted float alpha);
     undefined setStrokeColor(unrestricted float grayLevel, optional float alpha = 1);
     undefined setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
-    undefined setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
     undefined setFillColor(DOMString color, optional unrestricted float alpha);
     undefined setFillColor(unrestricted float grayLevel, optional unrestricted float alpha = 1);
     undefined setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
-    undefined setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
 
     // Non-standard functionality (CanvasImageData).
     readonly attribute float webkitBackingStorePixelRatio; // Always returns 1.

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (267644 => 267645)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-09-27 02:48:39 UTC (rev 267645)
@@ -931,14 +931,6 @@
     setStrokeStyle(CanvasStyle(color));
 }
 
-void CanvasRenderingContext2DBase::setStrokeColor(float c, float m, float y, float k, float a)
-{
-    auto color = CMYKA { c, m, y, k, a };
-    if (state().strokeStyle.isEquivalent(color))
-        return;
-    setStrokeStyle(CanvasStyle(color));
-}
-
 void CanvasRenderingContext2DBase::setFillColor(const String& color, Optional<float> alpha)
 {
     if (alpha) {
@@ -970,14 +962,6 @@
     setFillStyle(CanvasStyle(color));
 }
 
-void CanvasRenderingContext2DBase::setFillColor(float c, float m, float y, float k, float a)
-{
-    auto color = CMYKA { c, m, y, k, a };
-    if (state().fillStyle.isEquivalent(color))
-        return;
-    setFillStyle(CanvasStyle(color));
-}
-
 void CanvasRenderingContext2DBase::beginPath()
 {
     m_path.clear();

Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.cpp (267644 => 267645)


--- trunk/Source/WebCore/html/canvas/CanvasStyle.cpp	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.cpp	2020-09-27 02:48:39 UTC (rev 267645)
@@ -99,11 +99,6 @@
 {
 }
 
-CanvasStyle::CanvasStyle(const CMYKA<float>& colorComponents)
-    : m_style(CMYKAColor { convertToComponentBytes(toSRGBA(colorComponents)), colorComponents })
-{
-}
-
 CanvasStyle::CanvasStyle(CanvasGradient& gradient)
     : m_style(makeRefPtr(gradient))
 {
@@ -148,9 +143,6 @@
     if (WTF::holds_alternative<Color>(m_style) && WTF::holds_alternative<Color>(other.m_style))
         return WTF::get<Color>(m_style) == WTF::get<Color>(other.m_style);
 
-    if (WTF::holds_alternative<CMYKAColor>(m_style) && WTF::holds_alternative<CMYKAColor>(other.m_style))
-        return WTF::get<CMYKAColor>(m_style).components == WTF::get<CMYKAColor>(other.m_style).components;
-
     return false;
 }
 
@@ -159,11 +151,6 @@
     return WTF::holds_alternative<Color>(m_style) && WTF::get<Color>(m_style) == convertToComponentBytes(components);
 }
 
-bool CanvasStyle::isEquivalent(const CMYKA<float>& components) const
-{
-    return WTF::holds_alternative<CMYKAColor>(m_style) && WTF::get<CMYKAColor>(m_style).components == components;
-}
-
 void CanvasStyle::applyStrokeColor(GraphicsContext& context) const
 {
     WTF::switchOn(m_style,
@@ -170,15 +157,6 @@
         [&context] (const Color& color) {
             context.setStrokeColor(color);
         },
-        [&context] (const CMYKAColor& color) {
-            // FIXME: Do this through platform-independent GraphicsContext API.
-            // We'll need a fancier Color abstraction to support CMYKA correctly
-#if USE(CG)
-            CGContextSetCMYKStrokeColor(context.platformContext(), color.components.cyan, color.components.magenta, color.components.yellow, color.components.black, color.components.alpha);
-#else
-            context.setStrokeColor(color.colorConvertedToSRGBA);
-#endif
-        },
         [&context] (const RefPtr<CanvasGradient>& gradient) {
             context.setStrokeGradient(gradient->gradient());
         },
@@ -200,15 +178,6 @@
         [&context] (const Color& color) {
             context.setFillColor(color);
         },
-        [&context] (const CMYKAColor& color) {
-            // FIXME: Do this through platform-independent GraphicsContext API.
-            // We'll need a fancier Color abstraction to support CMYKA correctly
-#if USE(CG)
-            CGContextSetCMYKFillColor(context.platformContext(), color.components.cyan, color.components.magenta, color.components.yellow, color.components.black, color.components.alpha);
-#else
-            context.setFillColor(color.colorConvertedToSRGBA);
-#endif
-        },
         [&context] (const RefPtr<CanvasGradient>& gradient) {
             context.setFillGradient(gradient->gradient());
         },

Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.h (267644 => 267645)


--- trunk/Source/WebCore/html/canvas/CanvasStyle.h	2020-09-27 02:15:19 UTC (rev 267644)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.h	2020-09-27 02:48:39 UTC (rev 267645)
@@ -68,11 +68,6 @@
 private:
     struct Invalid { };
 
-    struct CMYKAColor {
-        Color colorConvertedToSRGBA;
-        CMYKA<float> components;
-    };
-
     struct CurrentColor {
         Optional<float> overrideAlpha;
     };
@@ -79,7 +74,7 @@
 
     CanvasStyle(CurrentColor);
 
-    Variant<Invalid, Color, CMYKAColor, RefPtr<CanvasGradient>, RefPtr<CanvasPattern>, CurrentColor> m_style;
+    Variant<Invalid, Color, RefPtr<CanvasGradient>, RefPtr<CanvasPattern>, CurrentColor> m_style;
 };
 
 bool isCurrentColorString(const String& colorString);
@@ -109,7 +104,7 @@
 
 inline String CanvasStyle::color() const
 {
-    return serializationForHTML(WTF::holds_alternative<Color>(m_style) ? WTF::get<Color>(m_style) : WTF::get<CMYKAColor>(m_style).colorConvertedToSRGBA);
+    return serializationForHTML(WTF::get<Color>(m_style));
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to