Closed Bug 779368 Opened 12 years ago Closed 12 years ago

svg elements rendered with incorrect size (not following spec)

Categories

(Core :: SVG, defect)

17 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 736431

People

(Reporter: freakabcd, Unassigned)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
Build ID: 20120731030541

Steps to reproduce:

Made a simple test page with an SVG element within it. The SVG element does *not* specify a height or width attribute.


Actual results:

SVG element rendered with what looks like a default size of width=300, height=150.


Expected results:

The SVG element should have rendered fully taking into account its child elements.
The incorrect rendering happens on most recent Nightly and also latest stable(14.x).
Attachment #647775 - Attachment mime type: text/plain → application/xhtml+xml
Adding width="100%" and height="100%" attributes to the SVG element makes it render correctly in both nightly and stable.

Stable renders the rect incorrectly, but that is another bug which *has* been fixed in nightly(possibly earlier).

I don't know where this 300x150 size comes from (probably a default for some elements), but it should not be applied to an SVG element as per the spec which says 100% must be used if width or height is not specified.

Earliest working draft I could find that has the document structure section with these attributes (width, height):
http://www.w3.org/TR/2002/WD-SVG11-20020215/struct.html#SVGElementWidthAttribute

Current recommendation:
http://www.w3.org/TR/SVG/struct.html#SVGElementWidthAttribute

Iceweasel 10.x on a debian machine renders this html file *correctly*.
Component: Untriaged → SVG
Product: Firefox → Core
Good find Alice; the 300x150 might be from there. But the SVG spec clearly states that width and height attributes should have the value "100%" if not specified for the svg element.

Also mentioned here:
https://developer.mozilla.org/en/SVG/Attribute/width

I do not know the specifics of when CSS is applied, but surely the width and height should not have a computed value of "auto".
> But the SVG spec clearly states that width and height attributes should have the value
> "100%" if not specified for the svg element.

It depends on which SVG spec you read.  The SVG 1.1 spec used to say things that were self-contradictory and 1.2 changed behavior from that to basically make the 100% values of width and height do nothing.  See bug 611099 and the spec links there.  Per the 1.2 spec as it stands, the computed width and height should in fact have computed value "auto" in this case.

That was discovered to not be compatible with the web, and the behavior was changed in bug 668163 such that omitting width and height is not equivalent to explicitly saying width="100%" height="100%".  I believe there is a pending spec issue on that.  Jonathan, can you confirm?

In any case, this is a duplicate of bug 736431, I believe....
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Yes. See the comments in bug 736431 and the bugs it links to.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: