Bug 234886

Summary: Add some functions to Color to make debugging using color indicators easier
Product: WebKit Reporter: Sam Weinig <sam>
Component: PlatformAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP
none
Patch
darin: review+
Patch none

Sam Weinig
Reported 2022-01-05 09:52:26 PST
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.
Attachments
WIP (2.20 KB, patch)
2022-01-09 11:08 PST, Sam Weinig
no flags
Patch (2.21 KB, patch)
2022-01-10 08:25 PST, Sam Weinig
darin: review+
Patch (2.32 KB, patch)
2022-01-12 10:06 PST, Sam Weinig
no flags
Sam Weinig
Comment 1 2022-01-09 11:08:44 PST Comment hidden (obsolete)
Sam Weinig
Comment 2 2022-01-10 08:25:12 PST
Darin Adler
Comment 3 2022-01-11 09:20:34 PST
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?
Antti Koivisto
Comment 4 2022-01-11 10:23:34 PST
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)
Antti Koivisto
Comment 5 2022-01-11 10:26:42 PST
> 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.
Sam Weinig
Comment 6 2022-01-12 06:54:00 PST
(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.
Radar WebKit Bug Importer
Comment 7 2022-01-12 09:53:17 PST
Sam Weinig
Comment 8 2022-01-12 10:06:01 PST
EWS
Comment 9 2022-01-12 10:57:58 PST
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].
Sam Weinig
Comment 10 2022-01-12 14:02:50 PST
Output is now: (lldb) p other.debugRGBA() (WebCore::Color::DebugRGBA) $0 = (red = 0, green = 0, blue = 0, alpha = 0)
Antti Koivisto
Comment 11 2022-01-12 21:44:55 PST
👍
Note You need to log in before you can comment on or make changes to this bug.