Bug 151468
Summary: | circle's r, cx, and cy should be parsed via fast path | ||
---|---|---|---|
Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> |
Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | bdakin, dino, kling, koivisto, krit, sabouhallawa, zimmermann |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=200439 |
Ryosuke Niwa
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Dirk Schulze
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.