4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
Created attachment 278213 [details] Patch
<rdar://problem/26131142>
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 '#' ?
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.
Committed r200501: <http://trac.webkit.org/changeset/200501>