@@ -625,7 +625,7 @@ probably in an appendix.
625625<div algorithm>
626626 CSS properties express their valid inputs with grammars,
627627 which are written with the assumption of being matched against strings parsed into CSS tokens,
628- as defined in [[css-syntax-3/ #tokenization]] .
628+ as defined in [[css-syntax-3#tokenization]] .
629629 {{CSSStyleValue}} objects can also be matched against these grammars, however.
630630
631631 A {{CSSStyleValue}} is said to <dfn for=CSSStyleValue>match a grammar</dfn>
@@ -2053,6 +2053,14 @@ interface CSSMathMax : CSSMathValue {
20532053 readonly attribute CSSNumericArray values;
20542054};
20552055
2056+ [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet),
2057+ Constructor(CSSNumberish min, CSSNumberish val, CSSNumberish max)]
2058+ interface CSSMathClamp : CSSMathValue {
2059+ readonly attribute CSSNumericValue min;
2060+ readonly attribute CSSNumericValue val;
2061+ readonly attribute CSSNumericValue max;
2062+ };
2063+
20562064[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
20572065interface CSSNumericArray {
20582066 iterable<CSSNumericValue>;
@@ -2067,6 +2075,7 @@ enum CSSMathOperator {
20672075 "invert",
20682076 "min",
20692077 "max",
2078+ "clamp",
20702079};
20712080</xmp>
20722081
@@ -2076,7 +2085,7 @@ It exists solely to host the common attributes
20762085of all the "math" operations.
20772086
20782087<div algorithm="CSSMathValue.operator">
2079- The <dfn attribute for="CSSMathValue, CSSMathSum, CSSMathProduct, CSSMathMin, CSSMathMax, CSSMathNegate, CSSMathInvert">operator</dfn> attribute
2088+ The <dfn attribute for="CSSMathValue, CSSMathSum, CSSMathProduct, CSSMathMin, CSSMathMax, CSSMathClamp, CSSMathNegate, CSSMathInvert">operator</dfn> attribute
20802089 of a {{CSSMathValue}} |this| must,
20812090 on getting,
20822091 return the following string,
@@ -2095,6 +2104,9 @@ of all the "math" operations.
20952104 : {{CSSMathMax}}
20962105 :: <code> "max"</code>
20972106
2107+ : {{CSSMathClamp}}
2108+ :: <code> "clamp"</code>
2109+
20982110 : {{CSSMathNegate}}
20992111 :: <code> "negate"</code>
21002112
@@ -2138,6 +2150,23 @@ of all the "math" operations.
21382150 it returns a {{CSSMathProduct}} .
21392151</div>
21402152
2153+ <div algorithm="CSSMathClamp(min, val, max)">
2154+ The <dfn constructor for="CSSMathClamp">CSSMathClamp(|min|, |val|, |max|)</dfn> constructor must,
2155+ when called,
2156+ perform the following steps:
2157+
2158+ 1. Replace |min|, |val|, and |max|
2159+ with the result of [=rectifying a numberish value=] for each.
2160+
2161+ 2. Let |type| be the result of [=adding=] the [=types=] of |min|, |val|, and |max|.
2162+ If |type| is failure,
2163+ [=throw=] a {{TypeError}} .
2164+
2165+ 3. Return a new {{CSSMathClamp}}
2166+ whose {{CSSMathClamp/min}} , {{CSSMathClamp/val}} , and {{CSSMathClamp/max}} internal slots
2167+ are set to |min|, |val|, and |max|, respectively.
2168+ </div>
2169+
21412170<div algorithm="CSSMathNegate(arg)">
21422171 The <dfn constructor for="CSSMathNegate">CSSMathNegate(|arg|)</dfn> constructor must,
21432172 when called,
@@ -2146,7 +2175,7 @@ of all the "math" operations.
21462175 1. Replace |arg|
21472176 with the result of [=rectifying a numberish value=] for |arg|.
21482177
2149- 1 . Return a new {{CSSMathNegate}}
2178+ 2 . Return a new {{CSSMathNegate}}
21502179 whose {{CSSMathNegate/value}} internal slot
21512180 is set to |arg|.
21522181
@@ -2167,6 +2196,10 @@ of all the "math" operations.
21672196 :: The [=type=] is the result of [=adding=] the [=types=]
21682197 of each of the [=list/items=] in its {{CSSMathSum/values}} internal slot.
21692198
2199+ : {{CSSMathClamp}}
2200+ :: The [=type=] is the result of [=adding=] the [=types=]
2201+ of the {{CSSMathClamp/min}} , {{CSSMathClamp/val}} , and {{CSSMathClamp/max}} internal slots.
2202+
21702203 : {{CSSMathProduct}}
21712204 :: The [=type=] is the result of [=multiplying=] the [=types=]
21722205 of each of the [=list/items=] in its {{CSSMathProduct/values}} internal slot.
0 commit comments