<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>135644</bug_id>
          
          <creation_ts>2014-08-06 03:36:52 -0700</creation_ts>
          <short_desc>Proportions of inline SVG element in HTML should respect width, height attributes</short_desc>
          <delta_ts>2022-07-15 17:00:26 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc>http://codepen.io/anon/pen/etblo</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jorge">chocolate.camera</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1027115</commentid>
    <comment_count>0</comment_count>
    <who name="Jorge">chocolate.camera</who>
    <bug_when>2014-08-06 03:36:52 -0700</bug_when>
    <thetext>Proportions of inline SVG in an HTML document should be taken from the `svg` element&apos;s `width` and `height` attributes, if they existing. Consequently, CSS-overriding both dimensions of that `svg` element, but setting one of them to `auto`, should scale both of them while maintaining their ratio relation.

## Steps to reproduce: ##

1.	Open &lt;http://codepen.io/anon/pen/etblo&gt; or open the embedded HTML file. The webpage features two instances of the same SVG object, each wrapped in a `figure` element:

	1.	One instance is inline, using an `svg` element with `width` and `height` attributes.
	2.	The other instance is linked externally (even though it is actually then embedded in the HTML with a data URI) with an `img` element. The `width` and `height` attributes have been moved from the external SVG object (the `svg` element of which, therefore, lacks them) to this `img` element.

	A minimal CSS is overriding both `svg` and `img` elements&apos; dimensions to `width: 100%; height: auto;`, therefore stating that the height should maintain its ratio relation with the width. The `figure` element&apos;s default CSS remains as `display: block;` therefore also `width: 100%;` by ommision (and then some margin, irrelevant to this issue).

2.	Scale the browser&apos;s window to a width considerably **less** than 800px.

3.	Scale the browser&apos;s window to a width considerably **more** than 800px.

## Expected results: ##

In both 2 &amp; 3, as the width of both `svg` and `img` elements change to fit the width of the window, their height should also change proportionally to the ratio relation between their respective `width` and `height` attributes.

## Actual results: ##

While the `img` element&apos;s height behaved as expected, the `svg` elements&apos; height remained fixed to the value of its `height` attribute, even though it had been overridden with CSS to stay proportional to the object&apos;s original aspect ratio, which should have been taken from its `width` and `height` attributes.

Consequently, in step 2, the `svg` element displays excessive blank on its top and bottom, and in step 3, it does so too in its left and right.

## Note ##

If, like I suggest, the browser should be using the `width` and `height` attributes of an element to define its original aspect ratio, I just do not know what the browser should actually do, in the case of an SVG object linked externally with an `img` element, when both the SVG object&apos;s `svg` element and the `img` element have `width` and `height` attributes with conflicting values. But I think that how to deal with conflicting values is, at any rate, a different issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027117</commentid>
    <comment_count>1</comment_count>
      <attachid>236088</attachid>
    <who name="Jorge">chocolate.camera</who>
    <bug_when>2014-08-06 03:39:57 -0700</bug_when>
    <thetext>Created attachment 236088
Webpage illustrating difference between dimensions of inline and external SVG (via img) when scaled proportionately</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884436</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-07-15 17:00:26 -0700</bug_when>
    <thetext>Safari, Chrome, and Firefox all agree on rendering for this test case. I don&apos;t believe there is any remaining compatibility issue.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>236088</attachid>
            <date>2014-08-06 03:39:57 -0700</date>
            <delta_ts>2014-08-06 03:39:57 -0700</delta_ts>
            <desc>Webpage illustrating difference between dimensions of inline and external SVG (via img) when scaled proportionately</desc>
            <filename>SVG aspect ratio.html</filename>
            <type>text/html</type>
            <size>1862</size>
            <attacher name="Jorge">chocolate.camera</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KCTxtZXRhIGNoYXJzZXQ9IlVURi04Ii8+Cgk8
dGl0bGU+U1ZHIHByb3BvcnRpb25hbCBzY2FsZSB0ZXN0PC90aXRsZT4KCTxzdHlsZT4KCQlpbWcs
IHN2ZyB7CgkJCXdpZHRoOiAxMDAlOwoJCQloZWlnaHQ6IGF1dG87CgkJfQoJCWZpZ2NhcHRpb24g
ewoJCQl0ZXh0LWFsaWduOiBjZW50ZXI7CgkJfQoJPC9zdHlsZT4KPC9oZWFkPgo8Ym9keT4KCTxw
PkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0LCBjb25zZWN0ZXR1ciBhZGlwaXNpY2luZyBlbGl0
LiBQYXJpYXR1ciBtYWduaSBhdHF1ZSwgZnVnaWF0IGJsYW5kaXRpaXMgaWQgbm9uIHZpdGFlIHJl
aWNpZW5kaXMgdm9sdXB0YXRlcyBuZXF1ZSBkb2xvcnVtIHZlcml0YXRpcywgdXQgbWFpb3JlcyBp
bGxvLCBlYSBxdWlkZW0gY3VwaWRpdGF0ZSB0ZW1wb3JhIHN1c2NpcGl0IG1vbGxpdGlhIQoJPC9w
PgoJPGZpZ3VyZT4KCQk8ZmlnY2FwdGlvbj5JbmxpbmUgU1ZHPC9maWdjYXB0aW9uPgoJCTxzdmcg
dmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhs
aW5rPSJodHRwOi8v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