Skip to content

[css-values-4] <angle> needs clamping details for degenerated values #6105

Closed

Description

@DevSDK

https://www.w3.org/TR/css-values-4/#calc-range

Hello, CSSWG folks!

I'm currently implementing the infinity and NaN for 'calc()' function on chromium.

The step of implementation is now clamping to other components per each types e.g. <length>, <time> and etc.

Now I will work <angle> but the spec doesn't specify how to clamp for <angle> type for infinity and -infinity (also NaN).

According to the spec, the degenerated values must be clamped maximum and lowest values per the types.

However, I think if the <angle> is clamped to the maximum value (i.e., ≈3.35544e+0) seems like no make sense. Because the infinity degree is not specified how it looks like. (My minor opinion is the infinity degree is should look like 0 degrees)

Therefore, I think this might need a discussion about how to clamp 'infinity degree' and 'infinity rad' and so on.

Activity

  1. DevSDK commented on Mar 17, 2021

    @DevSDK
    ContributorAuthor
  2. changed the title [-][css-values-4] <angle> need clamping details for degenerated values[/-] [+][css-values-4] <angle> needs clamping details for degenerated values[/+] on Mar 17, 2021
  3. fantasai commented on Mar 17, 2021

    @fantasai
    Collaborator

    Probably need to clarify that the actual value of a dimension is clamped to the implementable range, and for angles in particular this limit must be a multiple of 360deg.

    Treating infinity as zero wouldn't make sense because for something that e.g. rotates between 0deg and 2000deg, if the implementable limit were 1024deg (say), clamping the second value to zero wouldn't make sense.

  4. DevSDK commented on Mar 17, 2021

    @DevSDK
    ContributorAuthor

    Oh, thanks for the detailed comment :)
    I see, zero is no make sense.

    So, As I understood, the infinity degree should be the nearest multiple of 360deg from the maximum value. Am I correct?

    particular this limit must be a multiple of 360deg.

    Was it already existed in the spec or needed update?

  5. tabatkins commented on Mar 17, 2021

    @tabatkins
    Member

    That doesn't exist in the spec currently; we'd need to add it. I agree with it, tho - your intuition about treating it as 0deg was correct, it just needs to be equivalent to 0deg but with the correct distance from normal values.

  6. svgeesus commented on Mar 17, 2021

    @svgeesus
    Collaborator

    Now I will work but the spec doesn't specify how to clamp for type for infinity and -infinity (also NaN).

    Angles with NaN should be left as-is. This is depended on by some specifications. For example in CSS Color 4, NaN may be used for indeterminate hue angles (colors which are super close to the neutral axis).

    And CSS Color 4 also defines interpolation between hue angles, when one is NaN.

  7. tabatkins commented on Mar 17, 2021

    @tabatkins
    Member

    Hmmmm, that's not workable per current spec; NaN only exists within a calculation and is censored otherwise (to infinity) as it escapes the calculation. If Color is currently depending on detecting a NaN that spec text will never fire.

    I think what you want is that the hue is "missing", due to taking an achromatic color and interpolating it in a space with hue. Whether or not that ends up producing a hue angle of NaN when you run angle calculations in JS isn't necessarily relevant here.

    Outside of that implicit missing-ness produced by converting between representations, a NaN angle is only produced by nonsensical calculations, and probably should be treated the same as an infinite angle.

  8. xiaochengh commented on Mar 18, 2021

    @xiaochengh
    Contributor

    If I understand correctly, #6107 is a separate non-blocking issue, and this one only needs some spec edits?

  9. tabatkins commented on Mar 19, 2021

    @tabatkins
    Member

    Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions