Skip to content

Commit 1cee978

Browse files
committed
[css-values-5] Define how progress() handles start==end, and abstract a bit to reduce repetition. w3c#10980
1 parent b39a622 commit 1cee978

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

css-values-5/Overview.bs

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,29 @@ Interpolation Progress Functional Notations</h2>
531531
<var>progress-function</var>() = <var>progress-function</var>( <var>progress value</var> from <var>start value</var> to <var>end value</var> )
532532
</pre>
533533

534-
The resulting ratio is a <<number>>,
535-
which can then be input into other calculations,
534+
Each resolves to a <<number>>
535+
by [=calculating a progress function=].
536+
537+
<div algorithm>
538+
To <dfn export>calculate a progress function</dfn>,
539+
given a [=progress value=],
540+
[=progress start value=],
541+
and [=progress end value=]:
542+
543+
: If the [=progress start value=] and [=progress end value=] are different values
544+
:: <code>([=progress value=] - [=progress start value=]) / ([=progress end value=] - [=progress start value=])</code>.
545+
: If the [=progress start value=] and [=progress end value=] are the same value
546+
:: 0, -∞, or +∞,
547+
depending on whether [=progress value=]
548+
is equal to, less than, or greater than
549+
the shared value.
550+
551+
In either case, the result is a <<number>>,
552+
[=made consistent=] with the [=consistent type=]
553+
of the three arguments.
554+
</div>
555+
556+
The resulting number can then be input into other calculations,
536557
such as a [=math function=]
537558
or a [=mix notation=].
538559

@@ -546,11 +567,6 @@ Calculated Progress Values: the ''progress()'' notation</h3>
546567
between two other [=calculations=]
547568
(the [=progress start value=]
548569
and [=progress end value=]).
549-
The argument [=calculations=] can resolve to any <<number>>, <<dimension>>, or <<percentage>>,
550-
but must have a [=consistent type=]
551-
or else the function is invalid.
552-
The result will be a <<number>>,
553-
[=made consistent=] with the [=consistent type=] of the arguments.
554570

555571
The syntax of ''progress()'' is defined as follows:
556572

@@ -562,9 +578,12 @@ Calculated Progress Values: the ''progress()'' notation</h3>
562578
the [=progress value=], [=progress start value=], and [=progress end value=],
563579
respectively.
564580

565-
The value returned by a valid ''progress()'' notation is
566-
(<var>progress value</var> - <var>start value</var>) / (<var>end value</var> - <var>start value</var>),
567-
as a <<number>>.
581+
The argument [=calculations=] can resolve to any <<number>>, <<dimension>>, or <<percentage>>,
582+
but must have a [=consistent type=]
583+
or else the function is invalid.
584+
585+
The result will be a <<number>>,
586+
determined by [=calculating a progress function=].
568587

569588
ISSUE: Do we need a ''percent-progress()'' notation,
570589
or do enough places auto-convert that it's not necessary?
@@ -590,20 +609,18 @@ Media Query Progress Values: the ''media-progress()'' notation</h3>
590609
<dfn><<media-progress()>></dfn> = media-progress(<<media-feature>> from <<calc-sum>> to <<calc-sum>>)
591610
</pre>
592611

593-
The value returned by a valid ''media-progress()'' notation is
594-
<var>progress value</var> / (<var>end value</var> - <var>start value</var>,
595-
as a <<number>>.
612+
where the value of the <<media-feature>> is the [=progress value=],
613+
and the two calculations are the [=progress start value=] and [=progress end value=],
614+
respectively.
596615

597616
The specified [=media query=] must be a valid “range” type query,
598-
and its specified [=progress start value=] and [=progress end value=]
617+
and the specified [=progress start value=] and [=progress end value=]
599618
must be valid values for the specified [=media query=],
619+
and must have a [=consistent type=],
600620
or else the function is invalid.
601621

602-
The two input [=calculations=]
603-
but must have a [=consistent type=]
604-
or else the function is invalid.
605622
The result will be a <<number>>,
606-
[=made consistent=] with the [=consistent type=] of the arguments.
623+
determined by [=calculating a progress function=].
607624

608625
<h3 id="container-progress-func">
609626
Container Query Progress Values: the ''container-progress()'' notation</h3>
@@ -622,10 +639,15 @@ Container Query Progress Values: the ''container-progress()'' notation</h3>
622639
where the optional <<container-name>> component specifies
623640
the named containers to consider when selecting a container
624641
to resolve against.
642+
The value of the <<size-feature>> is the [=progress value=],
643+
and the two calculations are the [=progress start value=] and [=progress end value=],
644+
respectively.
625645

626-
The two input [=calculations=]
627-
but must have a [=consistent type=]
646+
The [=progress start value=] and [=progress end value=]
647+
must be valid values for the specified <<size-feature>>,
648+
and must have a [=consistent type=],
628649
or else the function is invalid.
650+
629651
The result will be a <<number>>,
630652
[=made consistent=] with the [=consistent type=] of the arguments.
631653

0 commit comments

Comments
 (0)