Open Bug 987629 Opened 10 years ago Updated 2 years ago

Size of svg ignored when embedded through <object> or <img>

Categories

(Core :: SVG, defect)

30 Branch
x86_64
Linux
defect

Tracking

()

UNCONFIRMED
Webcompat Priority P3

People

(Reporter: davve, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36

Steps to reproduce:

Load attached demo.


Actual results:

A green 300x150 rectangle is shown.


Expected results:

100x100 green rectangle.

Size of svg root box is ignored and 300x150 (the fallback size) used instead, for object, svg and rect.
This example came up in https://code.google.com/p/chromium/issues/detail?id=308992#c13 where we try to align SVG sizing in Firefox and Blink. We're not sure the current Firefox behavior is correct nor useful. What do you think?

Cameron, ed(at opera.com) told me to add you to cc. If you know of someone else within Mozilla this suits better, feel free to redirect.
I have two questions:

 * If width/heigth of svg elements are presentation attributes, should the intrinsic size from an embedded svg come from only the width/height attributes, and not style?

 * Should the root svg element (the svg viewport) always be the same size as the referencing element? Browsers disagree on this point. Opera/presto and IE allows them to diverge, Firefox keeps them together, even if it means ignoring specified style on the svg root.
Component: Untriaged → SVG
Product: Firefox → Core
Firefox's inconsistency between viewed-directly vs. embedded-in-<object> definitely seems iffy.

(See also bug 668163 and bug 850952, which were about related (but maybe different) width/height attribute-vs-property issues, FWIW.)

Also, the intrinsic size of an outer <svg> is computed in nsSVGOuterSVGFrame::GetIntrinsicSize():
http://mxr.mozilla.org/mozilla-central/source/layout/svg/nsSVGOuterSVGFrame.cpp?rev=ac6b0bcdea0b#160

...which says this:
> 163   // XXXjwatt Note that here we want to return the CSS width/height if they're
> 164   // specified and we're embedded inside an nsIObjectLoadingContent.

...which dates back to 2007 (bug 294086). I suspect if we addressed that, we'd produce David's expected results on his testcase.
Depends on: 294086
Daniel, thanks for bringing up bug 294086. I hadn't read that bug before. https://bugzilla.mozilla.org/show_bug.cgi?id=294086#c34 might be of interest to this bug, indicating current behavior is probably intentional.
See Also: → 1251566
Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: