[webkit-reviews] review granted: [Bug 44107] CSS: Make rgb() and rgba() fast paths case-insensitive : [Attachment 64719] Proposed patch v2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 18 10:26:00 PDT 2010


Darin Adler <darin at apple.com> has granted Andreas Kling
<andreas.kling at nokia.com>'s request for review:
Bug 44107: CSS: Make rgb() and rgba() fast paths case-insensitive
https://bugs.webkit.org/show_bug.cgi?id=44107

Attachment 64719: Proposed patch v2
https://bugs.webkit.org/attachment.cgi?id=64719&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
> +static inline bool mightBeRGBA(const UChar* characters, unsigned length)
> +{
> +    if (length < 5)
> +	   return false;
> +    return characters[4] == '('
> +	   && (characters[0] == 'r' || characters[0] == 'R')
> +	   && (characters[1] == 'g' || characters[1] == 'G')
> +	   && (characters[2] == 'b' || characters[2] == 'B')
> +	   && (characters[3] == 'a' || characters[3] == 'A');
> +}

This kind of check can be done considerably more efficiently like this:

    && (characters[0] | 0x20) == 'r'
    && (characters[1] | 0x20) == 'b'

r=me as-is but consider my faster version


More information about the webkit-reviews mailing list