negative width/height in viewBox should not disable rendering

RESOLVED FIXED in Firefox 47

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: roc, Assigned: roc)

Tracking

Trunk
mozilla47
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox47 fixed)

Details

()

Attachments

(1 attachment)

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/images/tstripadj.svg doesn't render in Firefox because it has a negative viewBox width. It does render (tiny) in Chrome. We should treat this viewBox attribute as invalid and ignore it.
Comment on attachment 8722825 [details]
MozReview Request: Bug 1250773. Ignore viewBoxes with negative width/height. r=heycam

https://reviewboard.mozilla.org/r/36257/#review32817

::: dom/svg/nsSVGViewBox.h:54
(Diff revision 1)
>     * This method does not check whether the width or height values are
>     * positive, so callers must check whether the viewBox rect is valid where
>     * necessary!

Update the comment to say it takes negative width/height into account.

::: dom/svg/nsSVGViewBox.h:68
(Diff revision 1)
>    bool IsExplicitlySet() const
>      { return mAnimVal || mHasBaseVal; }

Looking at the callers of IsExplicitlySet, I think we want to update it so that it returns false if we have a value with a negative width/height, too.
Attachment #8722825 - Flags: review?(cam)
The SVG 1.1 and SVG 2 specification say explicitly that negative values for width/height are an error. https://www.w3.org/TR/SVG2/coords.html#ViewBoxAttribute

They both then go on to say that the element or the part that is in error is not rendered. https://www.w3.org/TR/SVG2/implnote.html#ErrorProcessing

The specification really should be clearer as to what should occur here as ignore the viewBox and carry on rendering that element is not an obvious interpretation of that sentence.
Comment on attachment 8722825 [details]
MozReview Request: Bug 1250773. Ignore viewBoxes with negative width/height. r=heycam

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/36257/diff/1-2/
Comment on attachment 8722825 [details]
MozReview Request: Bug 1250773. Ignore viewBoxes with negative width/height. r=heycam

https://reviewboard.mozilla.org/r/36257/#review32835
Attachment #8722825 - Flags: review?(cam) → review+

Comment 8

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/4894d75bf376
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1269174
You need to log in before you can comment on or make changes to this bug.