You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* or just make the alpha and fallback successive optional args? */
3010
+
};
3011
+
3012
+
</xmp>
3013
+
3014
+
Issue: TODO add stringifiers
3015
+
3016
+
<div algorithm="CSSRGB()">
3017
+
The <dfn constructor for=CSSRGB>CSSRGB(|r|, |g|, |b|, optional |alpha|)</dfn> constructor
3018
+
must, when invoked,
3019
+
perform the following steps:
3020
+
3021
+
1. Let |r|, |g|, |b|, and |alpha|
3022
+
be replaced by the result of [=rectifying a percentish value=].
3023
+
3024
+
2. If |r|, |g|, and |b| don't all [=CSSNumericValue/match=] "number" or "percent",
3025
+
[=throw=] a {{TypeError}}.
3026
+
If |alpha| doesn't [=CSSNumericValue/match=] "percent",
3027
+
[=throw=] a {{TypeError}}.
3028
+
3029
+
3. Return a new {{CSSRGB}}
3030
+
with its {{CSSRGB/r}}, {{CSSRGB/g}}, {{CSSRGB/b}}, and {{CSSRGB/alpha}} internal slots
3031
+
set to |r|, |g|, |b|, and |alpha|.
3032
+
</div>
3033
+
3034
+
<div algorithm="CSSRGB.r">
3035
+
The <dfn attribute for=CSSRGB>r</dfn>,
3036
+
<dfn attribute for=CSSRGB>g</dfn>,
3037
+
<dfn attribute for=CSSRGB>b</dfn>,
3038
+
and <dfn attribute for=CSSRGB>alpha</dfn> attributes of a {{CSSRGB}} value
3039
+
must, on setting to a new value |val|,
3040
+
[=rectify a percentish value=] from |val|
3041
+
and set the corresponding internal slot to the result of that.
3042
+
</div>
3043
+
3044
+
<div algorithm="CSSHSL()">
3045
+
The <dfn constructor for=CSSHSL>CSSHSL(|h|, |s|, |l|, optional |alpha|)</dfn> constructor
3046
+
must, when invoked,
3047
+
perform the following steps:
3048
+
3049
+
1. Let |s|, |l|, and |alpha|
3050
+
be replaced by the result of [=rectifying a percentish value=].
3051
+
3052
+
2. If |h| doesn't [=CSSNumericValue/match=] "angle",
3053
+
[=throw=] a {{TypeError}}.
3054
+
If |s|, |l|, and |alpha| don't all [=CSSNumericValue/match=] "percent",
3055
+
[=throw=] a {{TypeError}}.
3056
+
3057
+
3. Return a new {{CSSHSL}}
3058
+
with its {{CSSHSL/h}}, {{CSSHSL/s}}, {{CSSHSL/l}}, and {{CSSHSL/alpha}} internal slots
3059
+
set to |h|, |s|, |l|, and |alpha|.
3060
+
</div>
3061
+
3062
+
<div algorithm="CSSHSL.s">
3063
+
The <dfn attribute for=CSSHSL>s</dfn>,
3064
+
<dfn attribute for=CSSHSL>l</dfn>,
3065
+
and <dfn attribute for=CSSHSL>alpha</dfn> attributes of a {{CSSHSL}} value
3066
+
must, on setting to a new value |val|,
3067
+
[=rectify a percentish value=] from |val|
3068
+
and set the corresponding internal slot to the result of that.
3069
+
</div>
3070
+
3071
+
<div algorithm="CSSHWB()">
3072
+
The <dfn constructor for=CSSHWB>CSSHWB(|h|, |w|, |b|, optional |alpha|)</dfn> constructor
3073
+
must, when invoked,
3074
+
perform the following steps:
3075
+
3076
+
1. Let |w|, |b|, and |alpha|
3077
+
be replaced by the result of [=rectifying a percentish value=].
3078
+
3079
+
2. If |h| doesn't [=CSSNumericValue/match=] "angle",
3080
+
[=throw=] a {{TypeError}}.
3081
+
If |w|, |b|, and |alpha| don't all [=CSSNumericValue/match=] "percent",
3082
+
[=throw=] a {{TypeError}}.
3083
+
3084
+
3. Return a new {{CSSHWB}}
3085
+
with its {{CSSHWB/h}}, {{CSSHWB/w}}, {{CSSHWB/b}}, and {{CSSHWB/alpha}} internal slots
3086
+
set to |h|, |w|, |b|, and |alpha|.
3087
+
</div>
3088
+
3089
+
<div algorithm="CSSHWB.w">
3090
+
The <dfn attribute for=CSSHWB>w</dfn>,
3091
+
<dfn attribute for=CSSHWB>b</dfn>,
3092
+
and <dfn attribute for=CSSHWB>alpha</dfn> attributes of a {{CSSHWB}} value
3093
+
must, on setting to a new value |val|,
3094
+
[=rectify a percentish value=] from |val|
3095
+
and set the corresponding internal slot to the result of that.
3096
+
</div>
3097
+
3098
+
<div algorithm="CSSLCH()">
3099
+
The <dfn constructor for=CSSLCH>CSSLCH(|l|, |c|, |h|, optional |alpha|)</dfn> constructor
3100
+
must, when invoked,
3101
+
perform the following steps:
3102
+
3103
+
1. Let |l|, |c|, and |alpha|
3104
+
be replaced by the result of [=rectifying a percentish value=].
3105
+
3106
+
2. If |h| doesn't [=CSSNumericValue/match=] "angle",
3107
+
[=throw=] a {{TypeError}}.
3108
+
If |l|, |c|, and |alpha| don't all [=CSSNumericValue/match=] "percent",
3109
+
[=throw=] a {{TypeError}}.
3110
+
3111
+
3. Return a new {{CSSLCH}}
3112
+
with its {{CSSLCH/l}}, {{CSSLCH/c}}, {{CSSLCH/h}}, and {{CSSLCH/alpha}} internal slots
3113
+
set to |l|, |c|, |h|, and |alpha|.
3114
+
</div>
3115
+
3116
+
<div algorithm="CSSLCH.l">
3117
+
The <dfn attribute for=CSSLCH>l</dfn>,
3118
+
<dfn attribute for=CSSLCH>c</dfn>,
3119
+
and <dfn attribute for=CSSLCH>alpha</dfn> attributes of a {{CSSLCH}} value
3120
+
must, on setting to a new value |val|,
3121
+
[=rectify a percentish value=] from |val|
3122
+
and set the corresponding internal slot to the result of that.
3123
+
</div>
3124
+
3125
+
<div algorithm="CSSLab()">
3126
+
The <dfn constructor for=CSSLab>CSSLab(|l|, |a|, |b|, optional |alpha|)</dfn> constructor
3127
+
must, when invoked,
3128
+
perform the following steps:
3129
+
3130
+
1. Let |l|, |a|, |b|, and |alpha|
3131
+
be replaced by the result of [=rectifying a percentish value=].
3132
+
3133
+
2. If |l|, |a|, |b|, and |alpha| don't all [=CSSNumericValue/match=] "percent",
3134
+
[=throw=] a {{TypeError}}.
3135
+
3136
+
3. Return a new {{CSSLab}}
3137
+
with its {{CSSLab/l}}, {{CSSLab/a}}, {{CSSLab/b}}, and {{CSSLab/alpha}} internal slots
3138
+
set to |l|, |a|, |b|, and |alpha|.
3139
+
</div>
3140
+
3141
+
<div algorithm="CSSLab.l">
3142
+
The <dfn attribute for=CSSLab>l</dfn>,
3143
+
<dfn attribute for=CSSLab>a</dfn>,
3144
+
<dfn attribute for=CSSLab>b</dfn>,
3145
+
and <dfn attribute for=CSSLab>alpha</dfn> attributes of a {{CSSLab}} value
3146
+
must, on setting to a new value |val|,
3147
+
[=rectify a percentish value=] from |val|
3148
+
and set the corresponding internal slot to the result of that.
3149
+
</div>
3150
+
3151
+
<div algorithm="CSSColor()">
3152
+
The <dfn constructor for=CSSColor>CSSColor(|colorspace|, |channels|, optional |alpha|)</dfn> constructor
3153
+
must, when invoked,
3154
+
perform the following steps:
3155
+
3156
+
1. Let |colorspace| be replaced by the result of [=rectifying a keywordish value=].
3157
+
Let |channels| be replaced by the result of [=rectifying a percentish value=] for each item in the list.
3158
+
Let |alpha| be replaced by the result of [=rectifying a percentish value=].
3159
+
3160
+
2. If |alpha| and the items of |channels| don't all [=CSSNumericValue/match=] "percent",
3161
+
[=throw=] a {{TypeError}}.
3162
+
3163
+
3. Return a new {{CSSColor}}
3164
+
with its {{CSSColor/colorspace}}, {{CSSColor/channels}}, and {{CSSColor/alpha}} internal slots
3165
+
set to |colorspace|, |channels|, and |alpha|.
3166
+
</div>
3167
+
3168
+
<div algorithm="CSSColor.colorspace">
3169
+
The <dfn attribute for=CSSColor>colorspace</dfn> attribute of a {{CSSColor}} value
3170
+
must, on setting to a new value |val|,
3171
+
[=rectify a keywordish value=] from |val|
3172
+
and set the corresponding internal slot to the result of that.
3173
+
3174
+
Issue: Phrase the per-item channels setting.
3175
+
3176
+
The <dfn attribute for=CSSColor>alpha</dfn> attribute of a {{CSSColor}} value
3177
+
must, on setting to a new value |val|,
3178
+
[=rectify a percentish value=] from |val|
3179
+
and set the corresponding internal slot to the result of that.
3180
+
</div>
3181
+
3182
+
<div algorithm>
3183
+
To <dfn export>rectify a percentish value</dfn> |num|,
3184
+
perform the following steps:
3185
+
3186
+
1. If |num| is a {{CSSNumericValue}},
3187
+
return |num|.
3188
+
3189
+
2. If |num| is a {{double}},
3190
+
return a [=new unit value=] from (|num|*100, "percent").
3191
+
</div>
3192
+
3193
+
3194
+
3195
+
3196
+
2861
3197
<!--
2862
3198
██████ ██████ ██████ ██ ███████ ██ ██
2863
3199
██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ███
@@ -5013,7 +5349,7 @@ same rules referenced above.
5013
5349
Reification can not fail for {{CSSResourceValue}} objects.
5014
5350
5015
5351
<div class='example'>
5016
-
The string 'url(''bike.png'')' is converted into a {{CSSURLImageValue}} with {{CSSResourceValue/state}} set to ''unloaded'' and the {{CSSURLImageValue/url}} set to ''https://drafts.css-houdini.org/css-typed-om/bike.png''. The {{CSSImageValue/intrinsicWidth}}, {{CSSImageValue/intrinsicHeight}} and {{CSSImageValue/intrinsicRatio}} are all set to null.
5352
+
The string 'url(''bike.png'')' is converted into a {{CSSURLImageValue}} with {{CSSResourceValue/state}} set to ''unloaded'' and the {{CSSURLImageValue/url}} set to ''https://drafts.css-houdini.org/css-typed-om/bike.png''.
0 commit comments