Closed Bug 709907 Opened 12 years ago Closed 12 years ago

"ASSERTION: Calling InvertSign with an unsupported unit"


(Core :: SVG, defect)

Not set





(Reporter: jruderman, Assigned: dholbert)



(Keywords: assertion, testcase)


(4 files)

Attached image testcase
###!!! ASSERTION: Calling InvertSign with an unsupported unit: 'Not Reached', file content/smil/nsSMILCSSValueType.cpp, line 154
Attached file stack trace
The unsupported unit in question is "eUnit_Dasharray", added in bug 523355, which nsSMILCSSValueType::InvertSign doesn't know about.

Rather than trying to teach nsSMILCSSValueType::InvertSign about the inner-workings of dash-array-valued nsStyleAnimation::Value objects, I think we should move InvertSign into nsStyleAnimation::Value (where it'll have access to private data, and where it'll be clearer that it needs updating if numeric/number-like types are added/modified in the future.
OS: Mac OS X → All
Hardware: x86_64 → All
Actually, I take that back -- I think we need to explicitly opt out stroke-dasharray from this negative-checking / inverting hack right now.

Basically what we do now is:
  if (value looks like "-[digit][anything]") {
    Strip off the "-" and try to parse the string after that as our property-value.
    If that parse succeeded {
       try to negate the resulting parsed value
    } else, parse failed --> fail.

This isn't sensitive enough for stroke-dasharray, though.  Supposing someone wants to animate by "-1, 2, 3, 4", then the above logic would end up trying to parse the value "1, 2, 3, 4", and then we'd "negate" that and use the resulting value.  But there's no clear way to negate "1, 2, 3, 4" (which values should we negate?)

For stroke-dasharray, we really need to do this checking / negation per-array-value, which our current logic doesn't really support.  So I think we should just opt stroke-dasharray out of this chunk.
Attached patch fix v1Splinter Review
As the comment at the top of the contextual code hints, bug 501188 would really the cleanest way to fix this -- given that, I don't think it's worth trying to add hackarounds to make stroke-dasharray work with negative values here.

So, this patch just disables the negative-value-screening logic for stroke-dasharray (so we pass the negative value along to the parser, and it'll fail to parse, which is probably fine).

Just for reference, in case it's not clear -- negative numbers would in theory be useful for something like:
  <rect stroke-dasharray="10, 10" ...>
    <animate attributeName="stroke-dasharray" by="-2, -2" ..>
The author's intention there would be to get a resulting animation towards "8, 8", but we'll fail to animate that right now, because "-2, -2" is an invalid value for stroke-dahsarray.
Assignee: nobody → dholbert
Attachment #581401 - Flags: review?(dbaron)
Comment on attachment 581401 [details] [diff] [review]
fix v1 (diff -w version)

r=dbaron, though I'm not sure if I'm the best reviewer for this
Attachment #581401 - Flags: review?(dbaron) → review+
(In reply to David Baron [:dbaron] from comment #6)
> r=dbaron

Thanks! :)

> though I'm not sure if I'm the best reviewer for this

I'm not concerned -- I mostly wanted a sanity-check, and I picked you since you wrote the code to add the unit in question ("eUnit_Dasharray", bug 523355), in case there was something obvious about it that I was missing.
Depends on: 523355
Flags: in-testsuite+
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.