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-typed-om] do types have hints? #1092

Open
gsnedders opened this issue Apr 25, 2023 · 1 comment
Open

[css-typed-om] do types have hints? #1092

gsnedders opened this issue Apr 25, 2023 · 1 comment

Comments

@gsnedders
Copy link
Member

c.f. https://drafts.css-houdini.org/css-typed-om-1/#numeric-typing

Each CSSNumericValue has an associated type, which is a map of base types to integers (denoting the exponent of each type, so a 2, such as from calc(1px * 1em), is «[ "length" → 2 ]»), and an associated percent hint (indicating that the type actually holds a percentage, but that percentage will eventually resolve to the hinted base type, and so has been replaced with it in the type).

By my reading, this means we have a:

struct CSSNumericValue {
  …
  Map[BaseType, Integer] types,
  Optional[BaseType] percent_hint,
}

Yet variously below we have things like:

If both type1 and type2 have non-null percent hints with different values

… which implies that the percent hint is part of the type, not associated with the CSSNumericValue. Unless "type1" and "type2" in this setting are the data associated with the CSSNumericValue, and not the "type" defined above?

@tabatkins
Copy link
Member

You're right, the hint is held by the type, not the value. I should fix the explanatory text you first quoted.

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