[Webkit-unassigned] [Bug 46066] SVG: Make SVGLength's stringToLengthType() stricter and faster
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 24 14:24:36 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=46066
Dirk Schulze <krit at webkit.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #68733|review? |review-
Flag| |
--- Comment #5 from Dirk Schulze <krit at webkit.org> 2010-09-24 14:24:36 PST ---
(From update of attachment 68733)
View in context: https://bugs.webkit.org/attachment.cgi?id=68733&action=review
The code is not realy faster with the mentioned changes, but looks more like the rest of the parsing code in SVGParserUttilities.cpp. And it may make it easier to change the code to ignore whitespaces at the end without parsing error later (the default behavior on Opera, but not specified yet) by just adding two more lines. The test looks great! Great patch!
> WebCore/svg/SVGLength.cpp:89
> +inline SVGLengthType stringToLengthType(const UChar* characters, const UChar* end)
const UChar*& ptr
> WebCore/svg/SVGLength.cpp:94
> + unsigned length = end - characters;
> +
> + if (!length)
> + return LengthTypeNumber;
if (ptr == end)
return LengthTypeNumber;
> WebCore/svg/SVGLength.cpp:105
> + if (length != 1 && length != 2)
> + return LengthTypeUnknown;
> +
> + const UChar lastChar = characters[length - 1];
> +
> + if (length == 1) {
> + if (lastChar == '%')
> + return LengthTypePercentage;
> + return LengthTypeUnknown;
> + }
const UChar firstChar = *ptr;
++ptr;
if (firstChar == '%') {
if (ptr == end)
return LengthTypePercentage;
return LengthTypeUnkown;
}
const UChar secondChar = *ptr;
if (++ptr != end)
return LengthTypeUnkown;
--
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