Summary: | Fix operator== and hash() for ExtendedColor | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||||||
Component: | Layout and Rendering | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | bfulgham, darin, dino, sam, simon.fraser, webkit-bug-importer, zalan | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Simon Fraser (smfr)
2020-05-16 22:23:01 PDT
Created attachment 399584 [details]
Patch
Created attachment 399593 [details]
Patch
Created attachment 399595 [details]
Patch
Comment on attachment 399595 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399595&action=review > Source/WebCore/platform/graphics/Color.h:320 > +// One or both may be extended. s/may/must/ Comment on attachment 399595 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399595&action=review > Source/WebCore/platform/graphics/ExtendedColor.h:78 > + return a.colorSpace() == b.colorSpace() && areEssentiallyEqual(a.channels(), b.channels()); How did you settle on "essentially equal" as the definition of ==, rather than something closer to floating point "=="? It seemed like the right thing to do? I didn't have any strong evidence to support either choice. I would suggest that "==" should be built on top of "==", with no shift to "essentially" done beneath the covers. In fact, reflecting on this I know it’s a problem for hashing! It‘s critical for hash functions that if two values compute as "==", then they have the same hash. That seems to not be true. |