Created attachment 498787 [details]
###!!! ASSERTION: viewport width must be nonnegative!: 'aViewportWidth >= 0', file layout/svg/base/src/nsSVGUtils.cpp, line 797
Created attachment 498788 [details]
This is a new assertion that I added in bug 272288 yesterday, to tighten up assumptions in nsSVGUtils::GetViewBoxTransform.
Negative widths aren't valid for <image> or <svg>, according to the spec:
"A negative value is an error (see Error processing)"
Not sure if we currently trigger error-handling-code for this case... If we don't want to bail out earlier than this, we could always just pass "max(0, width)" instead of "width" into nsSVGUtils::GetViewBoxTransform for cases like this.
We don't trigger error handling code as we don't distinguish between different types of length when we parse them. i.e. width (no negatives allowed) and x (negatives OK).
We just want to bail as early as possible in a way that makes mRect in nsSVGPathGeometryFrame the empty rect.
i.e. calling nsSVGUtils::GetViewBoxTransform is pretty pointless if width <= 0 as we're not going to draw anything.
Created attachment 598633 [details] [diff] [review]
Bail out earlier when computing CTM of an <svg> element with negative width/height attributes.