Skip to content

Servo's CSS parser converts absolute-unit lengths to a fixed-point representation even for specified values #15729

@bzbarsky

Description

@bzbarsky

Testcase:

<div style="width: 0.33px"></div>
<script>
  console.log(document.querySelector("div").style.width);
</script>

In servo this logs "0.31666666px". It should really preserve the original "0.33px" value.

In Gecko, specified values are stored as floating point plus unit, and not converted to 1/60 px integers until computed value time.

And even then, note that servo above is converting by truncation, whereas Gecko uses rounding. Specifically, Gecko does NSToCoordRoundWithClamp which checks for overflow issues, then rounds to nearest via NSToCoordRound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-styloC-assignedThere is someone working on resolving the issueC-has-open-prThere is a PR open that resolves the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions