Closed Bug 1310676 Opened 8 years ago Closed 8 years ago

another rgb->hsl mistranslation

Categories

(DevTools :: Framework, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: tromey, Assigned: tromey)

References

Details

https://bugzilla.mozilla.org/show_bug.cgi?id=1302787#c28 notes that
our JS code doesn't convert some hsl value (unfortunately you'll have
to dig into the tests to see which one) to rgb differently than platform.
Not sure how serious this is but perhaps it bears investigation.
Flags: qe-verify-
Priority: -- → P3
Whiteboard: [devtools-html] → [reserve-html]
This shows the failure:
diff --git a/devtools/client/shared/test/unit/test_cssColor-03.js b/devtools/client/shared/test/unit/test_cssColor-03.js
index 0657f74..1b002c3 100644
--- a/devtools/client/shared/test/unit/test_cssColor-03.js
+++ b/devtools/client/shared/test/unit/test_cssColor-03.js
@@ -24,6 +24,7 @@ const OLD_STYLE_TESTS = [
   "hsl(120, 100%, 40%)",
   "hsla(120, 100%, 40%, 0.25)",
   "hSlA(240, 100%, 50%, 0.25)",
+  "hsl(500, 5%, 5%)",
 ];
 
 const CSS_COLOR_4_TESTS = [


 0:00.55 TEST_STATUS: Thread-3 run_test FAIL [run_test : 48] color hsl(500, 5%, 5%) matches DOMUtils - {"r":12,"g":13,"b":13,"a":1} deepEqual {"a":1,"b":12,"g":13,"r":12}
Assignee: nobody → ttromey
Status: NEW → ASSIGNED
Iteration: --- → 52.3 - Nov 7
Priority: P3 → P1
I've looked into this a bit.

I can fix this particular bug by changing _hslValue to round
a bit differently -- using roundTo(..., 6) worked for me.

However, that then regresses test_cssColor-02.js, because it
breaks round-tripping from rgb->hsl->rgb.

I don't think this is a regression from any earlier state
(and I think regressions are what we're primarily concerned with here);
because CSS defines hsl->rgb but not the reverse.

Maybe this round-tripping could be fixed by preserving more digits
in the rgb->hsl translation, but then we're getting into "ugly display"
territory.  Also, in an earlier bug we discussed but rejected the idea
of having the CssColor object maintain state, on the basis that while
this would avoid this kind of problem, it would introduce a new user-visible
problem, namely incorrect round-tripping when moving between elements.

So on this basis I'm going to WONTFIX this.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
No longer blocks: devtools-html-3
Iteration: 52.3 - Nov 7 → ---
Priority: P1 → --
Whiteboard: [reserve-html]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.