Skip to content

Commit a418d94

Browse files
ccameron-chromiumsvgeesus
authored andcommitted
Update dynamic-range-limit-mix
1 parent bd78974 commit a418d94

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

css-color-hdr/Overview.bs

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ The 'dynamic-range-limit' property {#the-dynamic-range-limit-property}
257257

258258
<pre class='propdef'>
259259
Name: dynamic-range-limit
260-
Value: standard | high | constrained-high
260+
Value: standard | high | constrained-high | ''dynamic-range-limit-mix()''
261261
Initial: high
262262
Applies to: all elements
263263
Inherited: no
264264
Percentages: n/a
265-
Computed value: specified value
265+
Computed value: see <a href="#computing-dynamic-range-limit">Computed Value for 'dynamic-range-limit'</a>
266266
Animation type: by ''dynamic-range-limit-mix()''
267267
Canonical order: per grammar
268268
</pre>
@@ -309,10 +309,49 @@ Mixing Dynamic Range Limits: the ''dynamic-range-limit-mix()'' function {#dynami
309309

310310

311311
<pre class='prod'>
312-
<dfn>dynamic-range-limit-mix()</dfn> = dynamic-range-limit-mix( [ <<ident>> && <<percentage [0,100]>>? ]#{2})
312+
<dfn>dynamic-range-limit-mix()</dfn> = dynamic-range-limit-mix( [ <<ident>> && <<percentage [0,100]>> ]+)
313313
</pre>
314314

315-
Percentages are normalized in the same way as ''color-mix()''.
315+
If the sum of all percentages is 0%, then the function is invalid.
316+
317+
<h3 id="computing-dynamic-range-limit">
318+
Computed Value for 'dynamic-range-limit'
319+
</h3>
320+
321+
If the specified value is ''standard'', ''constrained-high'', or ''high'', then the computed value is the specified value.
322+
323+
If the specified value is ''dynamic-range-limit-mix()'', then the computed value is determined by the following algorithm:
324+
325+
1. Let <var>v1</var>, ..., <var>vN</var> be the computed values for the parameters to be mixed.
326+
2. Let <var>p1</var>, ..., <var>pN</var> be the mixing percentages, normalized to sum to 100%.
327+
3. Define the contributing percentages as:
328+
* Let <var>p1_standard</var>,...,<var>pN_standard</var> be the percentages for ''standard'' in <var>v1</var>,...,<var>vN</var>
329+
* Let <var>p1_constrained_high</var>,...,<var>pN_constrained_high</var> be the percentages for ''constrained-high'' in <var>v1</var>,...,<var>vN</var>
330+
* Let <var>p1_high</var>,...,<var>pN_high</var> be the percentages for ''high'' in <var>v1</var>,...,<var>vN</var>
331+
4. Compute the weighted sums as:
332+
* <var>p_standard</var>=(<var>p1_standard</var>*<var>p1</var>+...+<var>pN_standard</var>*<var>pN</var>)/100.
333+
* <var>p_constrained_high</var>=(<var>p1_constrained_high</var>*<var>p1</var>+...+<var>pN_constrained_high</var>*<var>pN</var>)/100.
334+
* <var>p_high</var>=(<var>p1_high</var>*<var>p1</var>+...+<var>pN_high</var>*<var>pN</var>)/100.
335+
5. If <var>p_standard</var>, <var>p_constrained_high</var>, or <var>p_high</var> equals 100%, then
336+
the computed value is ''standard'', ''constrained-high'', or ''high'', respectively.
337+
6. Otherwise, the computed value is ''dynamic-range-limit-mix()'', with parameters
338+
''standard'', ''constrained-high'', and ''high'', in that order, and percentages
339+
<var>p_standard</var>, <var>p_constrained_high</var>, and <var>p_high</var>,
340+
omitting parameters with a percentage equal to 0%.
341+
342+
<div class="example" id="ex-hdr-limit-mix">
343+
The computed value of
344+
<pre class="lang-css">
345+
dynamic-range-limit-mix(
346+
high 10%,
347+
dynamic-range-limit-mix(standard 25%, constrained-high 75%) 20%,
348+
dynamic-range-limit-mix(constrained-high 10%, high 30%) 20%)
349+
</pre>
350+
is
351+
<pre class="lang-css">
352+
dynamic-range-limit-mix(standard 10%, constrained-high 40%, high 50%)
353+
</pre>
354+
</div>
316355

317356
<h2 id="color-function">
318357
Specifying Predefined and Custom Color Spaces: the ''color()'' Function

0 commit comments

Comments
 (0)