Closed Bug 407495 Opened 13 years ago Closed 9 years ago
Make SVG documents with percentage width/height respond to page zoom
Page zoom scales images, text and other elements, except those that have percentage sizes. This can break many percentage-based page layouts, so it should be fixed. The URL is an SVG showing a bug, here is another (a HTML): data:text/html,<body style="margin:0"><div style="background: black; width: 50%; height: 50%"> Pagezoom in on any of these examples, and notice that they don't scale.
The percentage value is calculated against the viewport. The viewport size stays the same, no matter what zoom value. So this seems invalid to me.
Martjin is right. 50% of the viewport width means exactly what it says.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
clearing the blocking flag since this bug is resolved.
I don't think I agree about this bug being invalid. I'd think of this as "take the element size to be X% of the viewport, _then_ zoom/scale it in/up by Y. At any rate, I think it would be useful to get the thoughts of a few other people first. Whatever we choose, HTML and SVG should be consistent.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
If we were doing pixel-for-pixel scaling, comment 4 would be correct. But we're not. Zoom is just redefining the CSS-to-device pixel ratio. So the viewport size in CSS pixels actually becomes _smaller_ when you zoom, for example. So comment 1 is right on the money, I think. And HTML and SVG _are_ consistent, no?
HTML and SVG _are_ consistent.
Yes, HTML and SVG are currently consistent. I just meant that if we changed anything we should keep them consistent - sorry. I think from the average user's perspective it's going to be frustrating to have the Zoom In and Zoom Out menu items work on some content but have no effect on other content. Since percentage width/height are the common/default case in SVG, it'll be especially frustrating here. I'm not sure that the limitations of the way zoom is currently implemented should come before how it should ideally behave.
It's not a matter of limitation but a matter of what the goal is. Please see roc's blog about the various "ideal" behaviors for zoom. There are tradeoffs here, not just an obvious "ideal" behavior.
The problem here is that percentages shouldn't be calculated against the zoomed viewport, instead the original viewport should be the base of the calculation. Also, consider a rectangle which has a pixel height but a percentage width. When zooming, the shape of the rectangle changes, even though Zoom is supposed to change sizes, not shapes. (Maybe making percentage zoom on the document root max out at 100% is a good idea to prevent horizontal scrolling, however.)
I've seen pages/demos where this would be useful. However, changing this way would mean that when you zoom into a site using percentage widths, you would invariable need to scroll horizontally to see all the content, and that's a worse user experience on most real sites.
One thing we could do, I suppose, is to have different treatment for the case where the document root is percent-sized SVG whose content is going to be scaled to the viewport size. In that case we could apply the percentage sizing to the unscaled viewport, because we know that otherwise zooming is going to have no effect, which will surprise the user.
I now think we should, despite comment 4.
On the other hand, if you met a page that is way too wide for your screen (this is real problems, with some "webdesigner" wannabe that designs with stupidity in mind) you can have an option to resize the page to your viewport, while possibly enlarging the text to fit the eye.
Pages that are too wide for your screen are rarely too wide because of percentage widths, that would probably mean they were too wide for *any* screen. Jonathan, do you want to whip up a patch for this?
Shouldn't it be a more general component than SVG?
I agree with #12.
Assignee: nobody → jwatt
Status: REOPENED → ASSIGNED
Attachment #620607 - Flags: review?(roc)
Summary: Percentage sizes don't react to page zoom → Make SVG documents with percentage width/height respond to page zoom
Attachment #620607 - Flags: review?(roc) → review+
Target Milestone: --- → mozilla15
Status: ASSIGNED → RESOLVED
Closed: 13 years ago → 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.