Skip to content

[css-values-5] How to determine the type of <progress> in calc-mix()? #10770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cdoublev opened this issue Aug 23, 2024 · 1 comment
Open

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Aug 23, 2024

The type of calc-mix() must be made consistent with the type of its <progress>, which is defined with:

<progress> = [<percentage> | <number> | <'animation-timeline'>] && [by <easing-function>]?

What is the type of <progress> in these examples?

  1. calc-mix(0%, 1px, 2px) in a <length-percentage> context
  2. calc-mix(calc(0%), 1px, 2px) in a <length-percentage> context
  3. calc-mix(--timeline, 1px, 2px)

My respective guesses:

  1. [percentage → 1]
  2. [percentage → 1]
  3. []

In my opinion, the type of calc(0%) matching <progress> should always be [percentage → 1], whatever the "higher" context is.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Sep 6, 2024

Sorry, I missed that <percentage> should actually have been replaced with <percentage-token> in the <progress> production rule, as explained in the detailed definition appearing below the production rule:

<percentage-token> [...]

Note: This only allows literal percentages, like 15%; calculations like calc(100% / 7) will not work [...].

But this restriction seems to be motivated solely by internal constraints that authors would not understand it, imo.

Would it not be possible to say that <percentage> always resolves to [percentage → 1] as a term of a math function replacing <progress>?

cdoublev added a commit to cdoublev/css that referenced this issue Sep 11, 2024
- the type of <'animation-timeline'> for <progress> must be []
- the type of <percentage> for <progress> must be [percentage → 1]
- the type of <percentage> in math functions for <progress> must be [percentage → 1]
- the type of <percentage> in progress() must always be based on the closest context
- the type of <calc-mix()> calculations do not need to be made consistent with
  its <progress>

w3c/csswg-drafts#10770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant