SVG in floating container width and height problems
Reported by
que...@gmail.com,
Jul 26
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36 Example URL: https://bug1478026.bmoattachments.org/attachment.cgi?id=8994528 Steps to reproduce the problem: 1. Open a page with an svg in a floating div with style="width:auto;height:auto;" 2. 3. What is the expected behavior? The SVG should be displayed like it is with only width or height set to auto. What went wrong? The SVG is displayed with width=0 and height=0 (see screenshot) Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? No Does this work in other browsers? Yes Chrome version: 67.0.3396.99 Channel: stable OS Version: Ubuntu 18.04 Flash Version: Also style="SVG: width:100%;" is problematic (see screenshot)
,
Jul 26
,
Jul 27
quelbs@ - Thanks for filing the issue...!! Tried testing the issue by opening a page with an svg in a floating div with style="width:auto;height:auto;". But able to see a blank page only. Could you please a sample test file/url to test the issue from TE-end. This will help us in triaging the issue further. Thanks...!!
,
Jul 27
krajshree@, use the example URL given in #0: https://bug1478026.bmoattachments.org/attachment.cgi?id=8994528 This behavior is observed since at least Chrome 30, also in Firefox.
,
Jul 27
@krajshree, in your example the results is displaying the SVG with a size of 0x0 thus you see a "blank page" although it is not blank. Having an invalid html file causing chromium to be in "quirks mode", results in even more faulty displayings than in a valid html file I attached in the corresponding Firefox bug with the example link. And now also here as an attachment.
,
Jul 27
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 30
,
Jul 30
Verified. Another intrinsic sizing issue for SVG.
,
Aug 14
It's more of a general replaced element issue (it just so happens that using an SVG image is the only way you can currently produce something with an intrinsic ratio but lacking intrinsic width and height) - maybe shrink-to-fit?
,
Aug 14
Is the thing I attach here a good minimal test case?
,
Aug 14
Yes, seems like it (with possible reservation for the pass condition =))
,
Aug 14
What's wrong with it?
,
Aug 14
Possibly nothing, I'm not sure that the width would end up resolving to 100px though. But maybe it will.
,
Aug 14
Better find out before we attempt to fix it. :) Actually, the only browser I've found to display anything at all with this test, is Edge, which does 300x300. That may make more sense than 100x100, I guess? I.e. using the 300px fallback for width [1], and resolving height based on intrinsic ratio (1:1)? https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width
,
Aug 14
Yes, I guess that might make some sense (at least as much sense as the 300x150 dimensions usually make...)
,
Dec 19
While looking at another bug it dawn on me why the last three get a used width of 150px - LayoutImage uses LayoutImageResource::ImageSize which in turn uses ImageResourceContent::IntrinsicSize - which doesn't really return a correct intrinsic size in this case... So we get a preferred width of 150px because of that. With that fixed I suspect we would render the same as Gecko. |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by que...@gmail.com
, Jul 26