Make SVG documents with percentage width/height respond to page zoom

RESOLVED FIXED in mozilla15

Status

()

Core
SVG
RESOLVED FIXED
10 years ago
11 months ago

People

(Reporter: Gábor Stefanik, Assigned: jwatt)

Tracking

(Blocks: 1 bug, {testcase})

Trunk
mozilla15
testcase
Points:
---
Dependency tree / graph
Bug Flags:
wanted1.9.2 +

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
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.
Flags: blocking1.9?
(Reporter)

Updated

10 years ago
Blocks: 4821
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.
Keywords: testcase

Comment 2

10 years ago
Martjin is right. 50% of the viewport width means exactly what it says.
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID

Comment 3

10 years ago
clearing the blocking flag since this bug is resolved. 
Flags: blocking1.9?
(Assignee)

Comment 4

10 years ago
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 → ---

Updated

10 years ago
Duplicate of this bug: 406754
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?

Comment 7

10 years ago
HTML and SVG _are_ consistent.
(Assignee)

Comment 8

10 years ago
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.
(Reporter)

Comment 10

10 years ago
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.
(Assignee)

Comment 13

10 years ago
I now think we should, despite comment 4.

Comment 14

10 years ago
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?
(Assignee)

Updated

8 years ago
Flags: wanted1.9.2+

Updated

8 years ago
Duplicate of this bug: 503676

Comment 18

8 years ago
I agree with #12.

Updated

7 years ago
Duplicate of this bug: 606612

Updated

6 years ago
Duplicate of this bug: 719623
(Assignee)

Updated

5 years ago
(Assignee)

Comment 21

5 years ago
Created attachment 620607 [details] [diff] [review]
patch
Assignee: nobody → jwatt
Status: REOPENED → ASSIGNED
Attachment #620607 - Flags: review?(roc)
(Assignee)

Updated

5 years ago
Blocks: 455185
(Assignee)

Updated

5 years ago
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+
(Assignee)

Comment 22

5 years ago
Pushed https://hg.mozilla.org/integration/mozilla-inbound/rev/046fd4ab5b19
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/046fd4ab5b19
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago5 years ago
Resolution: --- → FIXED

Updated

11 months ago
Depends on: 843480
You need to log in before you can comment on or make changes to this bug.