NEW 151468
circle's r, cx, and cy should be parsed via fast path
https://bugs.webkit.org/show_bug.cgi?id=151468
Summary circle's r, cx, and cy should be parsed via fast path
Ryosuke Niwa
Reported 2015-11-19 17:19:50 PST
When a circle element's r, cx, and cy attributes are specified without unit, we end up parsing via yyparse. We should be using the fast path instead. This shows up as 10% of CPU time while loading the internal perf dashboard. We fail because parseSimpleLengthValue in CSSParser.cpp has a check for isStrictParserMode which returns false for SVG elements: if (unit == CSSPrimitiveValue::CSS_NUMBER) { if (number && isStrictParserMode(cssParserMode)) return CSSParser::ParseResult::Error; unit = CSSPrimitiveValue::CSS_PX; } I don't know this code or SVG well enough to tell why this early exit is needed.
Attachments
Dirk Schulze
Comment 1 2016-10-05 18:44:41 PDT
Can't comment on yyparse but to add some background to isStrictParserMode: It was a requirement of the CSS WG that all CSS specified layout properties (r, cx, cy, ..) in SVG must have units (just like every other length unit taking property). Attribute values are still allowed to be unit less for backwards compatibility reasons. isStrictParserMode is true if the property was specified by CSS (inline style or style sheet for instance) and false if the property was specified by an attribute.
Note You need to log in before you can comment on or make changes to this bug.