Skip to content

[css-color-4] Big number serialization problem #296

Closed

Description

@danielsakhapov

Test List

wpt.fyi/css/css-color/parsing/color-computed-color-function.html

Line:
test_computed_value("color", "color(display-p3 184 1.00001 2347329746587)", "color(display-p3 184 1.00001 2347329700000)", "[Display P3 color with component > 1 should not clamp]");

Rationale

Turned out there is an issue with CSS numbers serialization being completely different from browser to browser with none of them being correct spec compliant: https://drafts.csswg.org/cssom/#serializing-css-values.

So, for the sake of Interopt 2023 progress, I propose we move this test case to a separate file like this:
https://chromium-review.googlesource.com/c/chromium/src/+/4303721.

And solve the problem of serialization separately.

Activity

  1. added
    test-change-proposal
    on Mar 2, 2023
  2. foolip commented on Mar 7, 2023

    @foolip
    Member

    This split makes sense to me, since serialization is a generic problem. If we can agree in this issue we don't need to spend meeting time on it.

    @jgraham WDYT for Gecko?
    @jensimmons WDYT for WebKit?

  3. jgraham commented on Mar 7, 2023

    @jgraham
    Contributor

    I'm going to defer to @emilio

  4. emilio commented on Mar 7, 2023

    @emilio

    The whole point of this test is making sure that no clamping to 1 happens right? There's no need to use a massive number, can we just tweak the test to use, I dunno, 1000 rather than 2347329746587?

    The precision imposed by the spec is here, where you need 10 bits at least for display-p3.

    I haven't done the math but I'm not sure that number would necessarily round-trip with a half-float or a 10-bit representation for components.

  5. foolip commented on Mar 7, 2023

    @foolip
    Member

    @emilio the test was tweaked to use 234732 instead of 2347329746587, but do you mean we don't need the (split out) serialization test for big numbers at all?

  6. emilio commented on Mar 7, 2023

    @emilio

    Probably they'd be useful? But they are not specific to <color> at all right?

  7. foolip commented on Mar 7, 2023

    @foolip
    Member

    The tests use the color() function, but I assume the same difference can be observed with many property values. I wouldn't be surprised if there are difference in serialization in different contexts, so testing a few different things from different eras of CSS would be good.

  8. gsnedders commented on Mar 16, 2023

    @gsnedders
    Member

    Given the name of "Display P3 color with component > 1 should not clamp", it seems like we can reduce the value we're using in the test to anything > 1, and we definitely don't need a number anywhere near as high as the number currently in the test. As such, it seems reasonable to keep the test in Interop with a vastly lower value (like 1000, as @emilio suggested).

    If people in Interop believe the CSS WG should specify what the actual range that round-trips is (which CSS has historically shied away from, thus historic problems with decimal percentages and max z-index values, which has affected the majority of browser engines at some point), that seems like something to (once again) take to the CSS WG.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus area: Color Spaces and Functionstest-change-proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions