Skip to content
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

[css-values-5] Does serializing calc-size() ever change the number of arguments? #10259

Open
dbaron opened this issue Apr 26, 2024 · 3 comments

Comments

@dbaron
Copy link
Member

dbaron commented Apr 26, 2024

The definition of calc-size() doesn't mention serialization at all, and I think it probably should. In particular, the question I have about serialization is whether the number of arguments to calc-size() should ever change during a parse-serialize cycle. I think there are three options:

  1. Rerialize to the one-argument form whenever possible, otherwise serialize to the two-argument form. This has the downside that the two-argument form is often clearer, I think.
  2. Remember the number of arguments given and serialize in the form given.
  3. Always serialize to the two-argument form.

Based on what calc-size() does I don't especially like option 1. General principles of CSS serialization probably don't like 3, since shorter forms are generally preferred. And since this question applies to both specified and computed values (though the answer could be different for the two), and option 2 is pretty strange for computed values, I also don't particularly like option 2.

cc @tabatkins

@tabatkins
Copy link
Member

I agree that this needs specification. I lean towards option 3; I agree that in general the two-arg form is clearer.

@dbaron
Copy link
Member Author

dbaron commented May 9, 2024

I've implemented option 3 in Chromium.

@dbaron
Copy link
Member Author

dbaron commented May 9, 2024

Though thinking about it a little more, I think perhaps another argument against option 3 is that, without it, authors basically never need to write the two-argument form. For most things authors want, they just want to wrap one or both of the endpoints of an animation in calc-size(). So having the two-argument form appear for those cases might be confusing.

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

2 participants