RESOLVED FIXED 157402
4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
https://bugs.webkit.org/show_bug.cgi?id=157402
Summary 4 and 8 digit color attributes should use the crazypants algorithm, not the C...
Dean Jackson
Reported 2016-05-05 18:01:37 PDT
4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
Attachments
Patch (6.74 KB, patch)
2016-05-05 18:06 PDT, Dean Jackson
simon.fraser: review+
Dean Jackson
Comment 1 2016-05-05 18:06:35 PDT
Radar WebKit Bug Importer
Comment 2 2016-05-05 18:07:49 PDT
Simon Fraser (smfr)
Comment 3 2016-05-05 18:17:24 PDT
Comment on attachment 278213 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278213&action=review > Source/WebCore/html/HTMLElement.cpp:1150 > + if ((colorString.length() == 4 || colorString.length() == 7) && colorString[0] == '#') > + color = Color(colorString); > + if (!color.isValid()) > + color.setNamedColor(colorString); Should there be an 'else' here since a named color will never start with a '#' ?
Dean Jackson
Comment 4 2016-05-05 18:22:51 PDT
Comment on attachment 278213 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278213&action=review >> Source/WebCore/html/HTMLElement.cpp:1150 >> + color.setNamedColor(colorString); > > Should there be an 'else' here since a named color will never start with a '#' ? No. If it is a named color, it didn't pass the conditional above, which means it is still its default value (invalid). However, if it *is* something like "#abc" and it fails Color(colorString) then we want the next condition to execute. This is because "#fzz" is actually an ok value in HTML color attributes - it becomes rgb(15, 0, 0)!!! Yes, the whole thing is crazy. I don't even understand how this behaviour happened in the first place.
Dean Jackson
Comment 5 2016-05-05 18:26:13 PDT
Note You need to log in before you can comment on or make changes to this bug.