Antti wants some helpers on Color to make debugging he does where he uses colors in CSS to indicate things easier. And Antti gets what wants.
Created attachment 448715 [details] WIP
Created attachment 448753 [details] Patch
Comment on attachment 448753 [details] Patch Do we need to add a keyword to make sure this never gets dead-code stripped? Should these be non-member functions? In WTFString.cpp, string and asciiDebug are, but String::show is a member function. One advantage is that the functions donβt have to be in the header. But maybe they are easier to call?
Comment on attachment 448753 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=448753&action=review > Source/WebCore/platform/graphics/Color.h:185 > + ResolvedColorType<SRGBA<uint8_t>> debugComponents() const; debugRGBA? How does the output look in the debugger? (wondering if having a simple struct just for this would be somehow better)
> How does the output look in the debugger? (wondering if having a simple > struct just for this would be somehow better) These structs are very opaque so a simple 'struct DebugRGBA' might be nice in any case.
(In reply to Antti Koivisto from comment #5) > > How does the output look in the debugger? (wondering if having a simple > > struct just for this would be somehow better) > > These structs are very opaque so a simple 'struct DebugRGBA' might be nice > in any case. You're right. I was hoping because the actual members were really simple it would be nicer, but it looks like this: (lldb) p other.debugComponents() (WebCore::ResolvedColorType<WebCore::BoundedGammaEncoded<unsigned char, WebCore::SRGBADescriptor> >) $1 = { WebCore::ExposedColorType<WebCore::BoundedGammaEncoded<unsigned char, WebCore::SRGBADescriptor>, WebCore::RGBModel<unsigned char, WebCore::RGBBoundedness::Bounded> > = { WebCore::BoundedGammaEncoded<unsigned char, WebCore::SRGBADescriptor> = { WebCore::RGBAType<unsigned char, WebCore::SRGBADescriptor, WebCore::BoundedGammaEncoded<unsigned char, WebCore::SRGBADescriptor>, WebCore::RGBModel<unsigned char, WebCore::RGBBoundedness::Bounded>, WebCore::SRGBTransferFunction<> > = (red = '\0', green = '\0', blue = '\0', alpha = '\0') } } } I'll try something simpler. May want to use something larger than uint8_t for the components as well so they don't get confused for characters.
<rdar://problem/87465278>
Created attachment 448961 [details] Patch
Committed r287936 (245967@main): <https://commits.webkit.org/245967@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448961 [details].
Output is now: (lldb) p other.debugRGBA() (WebCore::Color::DebugRGBA) $0 = (red = 0, green = 0, blue = 0, alpha = 0)
π