Closed Bug 777265 Opened 12 years ago Closed 12 years ago

preserveAspectRatio on embedded SVG is not considered

Categories

(Firefox :: Untriaged, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 736431

People

(Reporter: gonsfx, Unassigned)

Details

User Agent: Opera/9.80 (X11; Linux i686; U; en) Presto/2.10.229 Version/11.61

Steps to reproduce:

Embed an SVGSVGElement with "preserveAspectRatio" attribute set into a fixed-size HTMLDivElement (both having different aspect ratios).


Actual results:

The value of the "preserveAspectRatio" attribute was not considered when positioning the SVGSVGElement inside the HTMLDivElement.


Expected results:

This is probably an edge case, but i assumed the "preserveAspectRatio" attribute would be taken into account when positioning the SVGSVGElement inside the HTMLDivElement the same way Opera and Chrome do.

Example for all possible "preserveAspectRatio" values:
http://jsfiddle.net/gonsfx/Rm2LE/
Verified on Firefox 14.01 (Linux) and Firefox 15.00 (Win)
You need to add width="100%" height="100%" as attributes on each svg element to get the outcome you desire.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
(In reply to Robert Longson from comment #2)
> You need to add width="100%" height="100%" as attributes on each svg element
> to get the outcome you desire.

Thats good to know.

Could you elaborate on why this works without setting width and height to 100% when you nest an SVGSVGElement in another SVGSVGElement and why this works in other browser vendors implementations?

I probably miss the difference here - what width and height does Firefox assume for an SVGSVGElement with a HTMLElement parent when there's no explicit width and height set?
Other browsers implementations are likely to follow suit I believe. width/height are "auto" by default in html world and that doesn't do what you want for svg. If you nest svg elements then you are in svg world and the default is "100%". You can find more technical information in bug 668163 comment 12 onwards
Great, thanks a lot!
Resolution: INVALID → DUPLICATE
You need to log in before you can comment on or make changes to this bug.