[webkit-reviews] review granted: [Bug 60703] CSS: Fast path for 'px' lengths should be case-insensitive. : [Attachment 93293] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 12 09:59:26 PDT 2011


Darin Adler <darin at apple.com> has granted Andreas Kling <kling at webkit.org>'s
request for review:
Bug 60703: CSS: Fast path for 'px' lengths should be case-insensitive.
https://bugs.webkit.org/show_bug.cgi?id=60703

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

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=93293&action=review

> Source/WebCore/css/CSSParser.cpp:380
> +	   && (characters[length - 2] == 'p' || characters[length - 2] == 'P')
> +	   && (characters[length - 1] == 'x' || characters[length - 1] == 'X'))
{

Another version would be:

    if (length > 2 && (characters[length - 2] | 0x20) == 'p' &&
(characters[length - 1] | 0x20) == 'x') {

This is more efficient on platforms where branches are expensive. We use this
idiom elsewhere in CSSParser.cpp for rgb and we even have a function for it in
KURL.cpp (isLetterMatchIgnoringCase) and LinkHash.cpp (matchLetter).


More information about the webkit-reviews mailing list