Closed Bug 405382 Opened 12 years ago Closed 12 years ago

Inline svg does not resize when window is shrunk and expanded

Categories

(Core :: SVG, defect, minor)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: firefoxbugs, Unassigned)

References

Details

Attachments

(1 file)

705 bytes, application/xhtml+xml
Details
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b1) Gecko/2007110904 Firefox/3.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b1) Gecko/2007110904 Firefox/3.0b1

When using svg with the width and height set to 100% inline in an .xhtml file the svg image doesn't expand back to 100% after the the window is resized.

Reproducible: Always

Steps to Reproduce:
1: Make an inline SVG in an XHTML document with the .xhtml extension.
2: Make sure the width and height of the inline SVG is set to 100%.
3: Make sure the SVG viewbox is set to some number large enough to be affected by resizing.
3: Load the file in a large but non-maximized window.
4: Resize the window to a small enough value to cause the SVG to resize.
5: Expand the window.
Actual Results:  
The SVG did not resize to the window size.

Expected Results:  
The SVG should resize to the full size.

This can be worked around by adding a height and width of 100% using CSS styles.
Can you retest in a latest trunk nightly. This was likely fixed by the checkin for bug 294086 which landed after beta 1. If it is not fixed then please post a complete test case as an attachment.
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
Adding dependency on bug 294086 so this stays on my radar.

As Robert requests, please try a build from http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/ and let us know if it's fixed now.
Depends on: 294086
Attached file SVG resize test
It now half works.  It will resize fine with changes in the z (width), but does
not respond at all in the y (height).  When the y is resized to a value smaller
than the SVG element a scroll bar appears and it doesn't attempt to resize
smaller nor bigger.  So the size is now 100% dependent on the x size and not at
all on the y.
That's actually the correct behavior according to the recent clarifications added to the SVG and CSS specifications. What's happening is this:

It is not possible to resolve the (implicit) 100% height on the SVG, because the CSS specification says that this height is relative to the <svg> element's containing block, and in this case, the height of the containing block (which is the <body>) depends on its content (the SVG). This circular dependency means that we have to look elsewhere to figure out what height to make the SVG. According to the CSS specification, we use the intrinsic ratio of the SVG together with the computed width of the SVG to figure out the height. According to the SVG specification, in this case, the intrinsic ratio comes from the viewBox attribute (viewBox="0 0 375 505").

The key point to understand is that the implicit 100% height can't be resolved.

I hope that this explanation clears things up, but if it doesn't, don't hesitate to ask for more info.
Okay, closing as fixed by the checkin for bug 294086.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.