Bug 194815 - SVG Image intrinsic size should be used if css style size is 'auto'
Summary: SVG Image intrinsic size should be used if css style size is 'auto'
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://wpt.live/svg/geometry/svg-imag...
Keywords: BlinkMergeCandidate, BrowserCompat, InRadar, WPTImpact
Depends on:
Blocks:
 
Reported: 2019-02-19 02:37 PST by Frédéric Wang (:fredw)
Modified: 2024-02-08 15:15 PST (History)
7 users (show)

See Also:


Attachments
Tentative Patch (4.32 KB, patch)
2019-02-21 07:15 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2019-02-19 02:37:14 PST
"The CSS width and height properties are used for sizing some SVG elements. Specifically, they are used to size ‘rect’, ‘svg’, ‘image’ and ‘foreignObject’. All of these elements have ‘width’ and ‘height’ presentation attributes. The properties are also used for laying out embedded elements from the HTML namespace. "
"The value auto for width and height on the ‘image’ element is calculated from the referenced image's intrinsic dimensions and aspect ratio, according to the CSS default sizing algorithm."
(https://www.w3.org/TR/SVG2/geometry.html#Sizing)

" A value of zero for either width or height disables rendering of the element and its embedded content. The 'auto' value for width or height is used to size the corresponding element automatically based on the intrinsic dimensions or intrinsic aspect ratio of the referenced resource. Computation of automatically-sized values follows the Default Sizing Algorithm defined for replaced elements in CSS layout [css-images-3]. In particular, when the referenced resource does not have an intrinsic size (such as an ‘iframe’ or an image types with no defined dimensions), it is assumed to have a width of 300px and a height of 150px."
(https://www.w3.org/TR/SVG2/embedded.html#Placement)

Essentially we should port Chromium's change:
https://codereview.chromium.org/2230963002
https://bugs.chromium.org/p/chromium/issues/detail?id=493681
Comment 2 Frédéric Wang (:fredw) 2019-02-21 07:15:16 PST
Created attachment 362604 [details]
Tentative Patch

Just trying to import https://chromium.googlesource.com/chromium/src.git/+/3c1a3822848d986337573cfaf2817c8a69417791 and align with Chromium. https://w3c-test.org/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto.html already times out without the patch applies, so there might be something wrong in WebKit's implementation.
Comment 3 Radar WebKit Bug Importer 2024-02-08 15:15:36 PST
<rdar://problem/122586485>