RESOLVED FIXED62203
stroke-dasharray does not handle "none"
https://bugs.webkit.org/show_bug.cgi?id=62203
Summary stroke-dasharray does not handle "none"
Dirk Schulze
Reported 2011-06-07 05:08:07 PDT
stroke-dasharray should handle value 'none' but doesn't. This is a parsing bug in parseSVGStrokeDasharray(). See http://trac.webkit.org/browser/trunk/Source/WebCore/css/SVGCSSParser.cpp#L316 I do not plan to work on that. Rob, isn't that something for you? Shouldn't be hard to fix. We just need a check like in CSSParser.cpp: if (value->id == CSSValueNone || (value->unit == CSSPrimitiveValue::CSS_STRING && equalIgnoringCase(value->string, "none"))) { return primitiveValueCache()->createIdentifierValue(CSSValueNone); But because we have a comma separated list we have to check for something like "none,3" as well. This would be an invalid string.
Attachments
Patch (38.83 KB, patch)
2011-06-07 11:21 PDT, Rob Buis
no flags
Patch (61.67 KB, patch)
2011-06-07 11:52 PDT, Rob Buis
no flags
Patch (61.67 KB, patch)
2011-06-07 12:05 PDT, Rob Buis
no flags
Patch (78.48 KB, patch)
2011-06-07 13:09 PDT, Rob Buis
krit: review+
Rob Buis
Comment 1 2011-06-07 07:30:28 PDT
Hi Dirk, (In reply to comment #0) > stroke-dasharray should handle value 'none' but doesn't. This is a parsing bug in parseSVGStrokeDasharray(). > See http://trac.webkit.org/browser/trunk/Source/WebCore/css/SVGCSSParser.cpp#L316 > I do not plan to work on that. Rob, isn't that something for you? Shouldn't be hard to fix. > We just need a check like in CSSParser.cpp: > if (value->id == CSSValueNone || (value->unit == CSSPrimitiveValue::CSS_STRING && equalIgnoringCase(value->string, "none"))) { > return primitiveValueCache()->createIdentifierValue(CSSValueNone); > But because we have a comma separated list we have to check for something like "none,3" as well. This would be an invalid string. Good find! Yes I'll take a look. Cheers, Rob.
Rob Buis
Comment 2 2011-06-07 11:21:49 PDT
Rob Buis
Comment 3 2011-06-07 11:52:47 PDT
Darin Adler
Comment 4 2011-06-07 11:52:47 PDT
Comment on attachment 96264 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=96264&action=review > Source/WebCore/css/SVGCSSParser.cpp:245 > + parsedValue = CSSValueList::createCommaSeparated(); This seems like a roundabout way to achieve tis. While it’s true that we use an empty vector to represent an empty dash array, creating an empty CSS value list for parsing purposes is not the normal way we handle such things. Shouldn’t the fix be in SVGCSSStyleSelector.cpp instead? > Source/WebCore/css/SVGCSSParser.cpp:248 > + } > else In WebKit coding style we put the brace on the same line as the else.
Rob Buis
Comment 5 2011-06-07 12:03:00 PDT
Hi Darin, (In reply to comment #4) > (From update of attachment 96264 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=96264&action=review > > > Source/WebCore/css/SVGCSSParser.cpp:245 > > + parsedValue = CSSValueList::createCommaSeparated(); > > This seems like a roundabout way to achieve tis. While it’s true that we use an empty vector to represent an empty dash array, creating an empty CSS value list for parsing purposes is not the normal way we handle such things. Shouldn’t the fix be in SVGCSSStyleSelector.cpp instead? You are right, I started with that approach, not sure why I changed it later. > > Source/WebCore/css/SVGCSSParser.cpp:248 > > + } > > else > > In WebKit coding style we put the brace on the same line as the else. Strange that the style checker didn't get it. Thanks for the review, new patch coming up. Cheers, Rob.
Rob Buis
Comment 6 2011-06-07 12:05:15 PDT
Rob Buis
Comment 7 2011-06-07 13:09:30 PDT
Dirk Schulze
Comment 8 2011-06-07 13:36:53 PDT
Comment on attachment 96288 [details] Patch LGTM. r=me.
Rob Buis
Comment 9 2011-06-07 14:15:47 PDT
Note You need to log in before you can comment on or make changes to this bug.