RESOLVED FIXED 212143
Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication
https://bugs.webkit.org/show_bug.cgi?id=212143
Summary Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat s...
Sam Weinig
Reported 2020-05-20 09:02:34 PDT
Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication
Attachments
Patch (17.83 KB, patch)
2020-05-20 09:25 PDT, Sam Weinig
no flags
Patch (17.76 KB, patch)
2020-05-20 09:45 PDT, Sam Weinig
no flags
Patch (23.15 KB, patch)
2020-05-20 15:09 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2020-05-20 09:25:59 PDT
Sam Weinig
Comment 2 2020-05-20 09:45:54 PDT
Simon Fraser (smfr)
Comment 3 2020-05-20 10:25:31 PDT
Comment on attachment 399847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399847&action=review > Source/WebCore/editing/ReplaceSelectionCommand.cpp:550 > + return lightness(color.value().toSRGBAComponentsLossy()); Ideally we'd be able to compute lightness for any colorspace without converting to sRGB. Which makes me think that lightness() should stay as a function on Color. This will be especially true when we have LAB color where lightness is just one of the components. > Source/WebCore/editing/cocoa/DataDetection.mm:628 > + auto underlineColor = Color(makeRGBAFromHSLA(hue, saturation, overrideLightness, overrideAlphaMultiplier * alpha)); Make sure the hue is correctly round-tripped here. > Source/WebCore/page/FrameView.cpp:368 > + if (lightness(backgroundColor.toSRGBAComponentsLossy()) <= .5f && backgroundColor.isVisible()) Yeah, this would be much better with backgroundColor.getHSL.lightness().
Sam Weinig
Comment 4 2020-05-20 10:35:52 PDT
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 399847 [details] > Patch > > Source/WebCore/page/FrameView.cpp:368 > > + if (lightness(backgroundColor.toSRGBAComponentsLossy()) <= .5f && backgroundColor.isVisible()) > > Yeah, this would be much better with backgroundColor.getHSL.lightness(). Would you be ok with backgroundColor.lightness()?
Simon Fraser (smfr)
Comment 5 2020-05-20 13:52:46 PDT
(In reply to Sam Weinig from comment #4) > (In reply to Simon Fraser (smfr) from comment #3) > > Comment on attachment 399847 [details] > > Patch > > > > Source/WebCore/page/FrameView.cpp:368 > > > + if (lightness(backgroundColor.toSRGBAComponentsLossy()) <= .5f && backgroundColor.isVisible()) > > > > Yeah, this would be much better with backgroundColor.getHSL.lightness(). > > Would you be ok with backgroundColor.lightness()? That's actually what I mean to write!
Sam Weinig
Comment 6 2020-05-20 14:00:12 PDT
Comment on attachment 399847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399847&action=review >> Source/WebCore/editing/cocoa/DataDetection.mm:628 >> + auto underlineColor = Color(makeRGBAFromHSLA(hue, saturation, overrideLightness, overrideAlphaMultiplier * alpha)); > > Make sure the hue is correctly round-tripped here. I think this is wrong now. Going to make an API test with round-tripping to see.
Sam Weinig
Comment 7 2020-05-20 15:09:52 PDT
EWS
Comment 8 2020-05-20 15:54:16 PDT
Committed r261967: <https://trac.webkit.org/changeset/261967> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399897 [details].
Radar WebKit Bug Importer
Comment 9 2020-05-20 15:55:17 PDT
Note You need to log in before you can comment on or make changes to this bug.