[Webkit-unassigned] [Bug 68995] Height of SVG element is incorrectly calculated when svg when width of containing element is set as a percentage

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 9 22:07:01 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=68995


Dirk Schulze <krit at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |krit at webkit.org




--- Comment #7 from Dirk Schulze <krit at webkit.org>  2012-07-09 22:07:00 PST ---
(In reply to comment #6)
> After some further discussion on IRC it looks like the issue boils down to calculating the height of an SVG element with viewBox set. WebKit appears to be using 100% of the viewport... is that correct?
> 
> Here's a smaller testcase:
> http://jsfiddle.net/FTcSA/2/
> 
> Notice that in WebKit the box is centered, whereas Firefox leaves it at the top.

I can just say that the behavior is looks incorrect. The actual size of the SVG is dependent on the CSS box of the SVG. This must be specified directly:

<svg style="width: 100px; height:100px">

The with and height attribute are independent of the properties. If the properties were not specified, the default size (calculated value) for an inline SVG is 500px to 250px.

That is what Firefox and Opera are doing if you do NOT specify a viewBox. Strangely this behavior changes if a viewBox was specified. I don't see a reason for that. IE10 on the other side, is doing what I would expect.

To the centralization: This depends on the default values of preserveAspectRatio. However, if we assume that the 500px to 250px are not used in combination with viewBox (which does not make sense), the size should be dependent on the viewport (which also makes not much sense in HTML), and the behavior of WebKit would be correct. Just like it would be for a standalone SVG.

But like I said, the SVG size should not be scaled, and the rect should fit in the size of 500px to 250px IMO. Since this is just a resolution of the SVG WG and not specified, it might be a good idea to bring it up on the www-svg mailing list, or open bugs for other browsers :).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list