Skip to content

[css-values-4] round(line-width, ...) specification is confusing #13794

@romainmenke

Description

@romainmenke

see:

Otherwise, identical to nearest, except that if A is positive (non-zero) and one of lower B or upper B is zero, choose the non-zero one, then snap as a border width.

Can be read as:

  • line-width is almost identical to nearest
  • has an exception when lower/upper B is zero and ...
  • always snaps to border width

This violates the assert in https://drafts.csswg.org/css-values-4/#snap-a-length-as-a-border-width

Assert: len is non-negative.

or:

  • line-width is almost identical to nearest
  • has an exception when lower/upper B is zero and ... only when in this exception -> snap to border width

When upper and lower B are both non-zero and A is positive (non-zero) there still isn't any border width snapping. This seems weird to me.


If <rounding-strategy> is line-width, B may also be omitted and has special behavior (defined above) essentially defaulting it to one device pixel. In all other cases, omitting B is invalid.

Can be read as:

  • line-width allows B to be omitted
  • always has special behavior -> snapping to border width

or:

  • line-width allows B to be omitted
  • only when B is omitted the value is snapped to border width

@tabatkins I assume the intention is to always have the border width snapping behavior?
It might help to split into a bit more sentences :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions