[Webkit-unassigned] [Bug 46066] SVG: Optimize stringToLengthType()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 19 23:55:12 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=46066


Dirk Schulze <krit at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #68042|review?                     |review-
               Flag|                            |




--- Comment #3 from Dirk Schulze <krit at webkit.org>  2010-09-19 23:55:12 PST ---
(From update of attachment 68042)
View in context: https://bugs.webkit.org/attachment.cgi?id=68042&action=prettypatch

> WebCore/svg/SVGLength.cpp:97
> +    if (characters[length - 1] == '%')

Can you put UChar b = characters[length - 1]; right before this check? The names should indicate the content. Can you use 'lastChar' for b or simply 'end'? a also needs a better name. Just a bit strange that we give back number, if the string doesn't end with a length type that we know.

> WebCore/svg/SVGLength.cpp:104
> +    UChar a = characters[length - 2];
> +    UChar b = characters[length - 1];
Should be const.

I was looking at setValueAsString, the caller of this function. And it looks bogus to me, to just check the last or last two chars. Following example would parse on WebKit, while it doesn't on other Viewers:
<rect width="20    mm" height="20*SomethinStupid*px"/>

Can't you just use 'ptr' and 'end' of setValueAsString? 'ptr' is the first char after the parsed number of the string. We don't need String at all on lengthTypeToString. This change will need new layouttests.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list