Skip to content

Commit 8682aeb

Browse files
committed
[css-typed-om-1] Add device-cmyk() support.
1 parent 8d19906 commit 8682aeb

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

css-typed-om/Overview.bs

+51
Original file line numberDiff line numberDiff line change
@@ -2887,6 +2887,7 @@ interface CSSColorValue : CSSStyleValue {
28872887
CSSLCH toLCH();
28882888
CSSLab toLab();
28892889
CSSColor toColor(CSSKeywordish colorspace);
2890+
CSSDeviceCMYK toDeviceCMYK();
28902891

28912892
[Exposed=Window] static CSSColorValue parse(USVString cssText);
28922893
};
@@ -2934,6 +2935,17 @@ interface CSSColorValue : CSSStyleValue {
29342935
with TODO.
29352936
</div>
29362937

2938+
<div algorithm="CSSColorValue.toDeviceCMYK()">
2939+
The <dfn method for=CSSColorValue>toDeviceCMYK()</dfn> method
2940+
of {{CSSColorValue}} object must,
2941+
when called on |this|,
2942+
convert |this| into an sRGB color,
2943+
then [=naively convert from RGBA to CMYK=]
2944+
and return a new {{CSSDeviceCMYK}} object
2945+
with its {{CSSDeviceCMYK/c}}, {{CSSDeviceCMYK/m}}, {{CSSDeviceCMYK/y}}, {{CSSDeviceCMYK/k}}, and {{CSSDeviceCMYK/alpha}} internal slots
2946+
set appropriately to represent that color.<
2947+
/div>
2948+
29372949
<div algorithm="CSSColorValue.parse()">
29382950
The <dfn method for=CSSColorValue>parse(|cssText|)</dfn> method,
29392951
when called,
@@ -3011,6 +3023,16 @@ interface CSSColor : CSSColorValue {
30113023
attribute CSSPercentishArray channels;
30123024
attribute CSSNumberish alpha;
30133025
};
3026+
3027+
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
3028+
interface CSSDeviceCMYK : CSSColorValue {
3029+
constructor(CSSNumberish c, CSSNumberish m, CSSNumberish y, CSSNumberish k, optional CSSNumberish alpha = 1);
3030+
attribute CSSNumberish c;
3031+
attribute CSSNumberish m;
3032+
attribute CSSNumberish y;
3033+
attribute CSSNumberish k;
3034+
attribute CSSNumberish alpha;
3035+
};
30143036
</xmp>
30153037

30163038
Issue: TODO add stringifiers
@@ -3221,6 +3243,35 @@ The {{CSSColor}} class represents the CSS ''color()'' function.
32213243
and set the corresponding internal slot to the result of that.
32223244
</div>
32233245

3246+
The {{CSSDeviceCMYK}} class represents the CSS ''device-cmyk()'' function.
3247+
3248+
<div algorithm="CSSDeviceCMYK()">
3249+
The <dfn constructor for=CSSDeviceCMYK>CSSDeviceCMYK(|c|, |m|, |y|, |k|, optional |alpha|)</dfn> constructor
3250+
must, when invoked,
3251+
perform the following steps:
3252+
3253+
1. Let |c|, |m|, |y|, |k|, and |alpha|
3254+
be replaced by the result of [=rectifying a percentish value=].
3255+
3256+
2. If |c|, |m|, |y|, |k|, and |alpha| don't all [=CSSNumericValue/match=] "percent",
3257+
[=throw=] a {{TypeError}}.
3258+
3259+
3. Return a new {{CSSDeviceCMYK}}
3260+
with its {{CSSDeviceCMYK/c}}, {{CSSDeviceCMYK/m}}, {{CSSDeviceCMYK/y}}, {{CSSDeviceCMYK/k}}, and {{CSSLab/alpha}} internal slots
3261+
set to |c|, |m|, |y|, |k|, and |alpha|.
3262+
</div>
3263+
3264+
<div algorithm="CSSDeviceCMYK.c">
3265+
The <dfn attribute for=CSSDeviceCMYK>c</dfn>,
3266+
<dfn attribute for=CSSDeviceCMYK>m</dfn>,
3267+
<dfn attribute for=CSSDeviceCMYK>y</dfn>,
3268+
<dfn attribute for=CSSDeviceCMYK>k</dfn>,
3269+
and <dfn attribute for=CSSDeviceCMYK>alpha</dfn> attributes of a {{CSSDeviceCMYK}} value
3270+
must, on setting to a new value |val|,
3271+
[=rectify a percentish value=] from |val|
3272+
and set the corresponding internal slot to the result of that.
3273+
</div>
3274+
32243275
<div algorithm>
32253276
To <dfn export>rectify a percentish value</dfn> |num|,
32263277
perform the following steps:

0 commit comments

Comments
 (0)