<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Webkit not recalculating width when changing height of absolute-positioned div with image"
   href="https://bugs.webkit.org/show_bug.cgi?id=152588#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Webkit not recalculating width when changing height of absolute-positioned div with image"
   href="https://bugs.webkit.org/show_bug.cgi?id=152588">bug 152588</a>
              from <span class="vcard"><a class="email" href="mailto:zalan&#64;apple.com" title="zalan &lt;zalan&#64;apple.com&gt;"> <span class="fn">zalan</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=152588#c0">comment #0</a>)
<span class="quote">&gt; Created <span class=""><a href="attachment.cgi?id=267987" name="attach_267987" title="Page that demonstrates bug">attachment 267987</a> <a href="attachment.cgi?id=267987&amp;action=edit" title="Page that demonstrates bug">[details]</a></span>
&gt; Page that demonstrates bug
&gt; 
&gt; StackOverflow issue, has an example you can run:
&gt; <a href="http://stackoverflow.com/questions/34506314/webkit-bug-rendering-image-in">http://stackoverflow.com/questions/34506314/webkit-bug-rendering-image-in</a>-
&gt; centered-absolute-div
&gt; 
&gt; Basically I have a relatively position div, with a absolutely positioned div
&gt; child.  Inside the absolutely positioned div is a (square) image:
&gt; &lt;div relative&gt;
&gt;  &lt;div absolute&gt;
&gt;   &lt;img /&gt;
&gt;  &lt;/div&gt;
&gt; &lt;/div&gt;
&gt; 
&gt; Both absolute and img have height: 100%, so when relative changes height, so
&gt; should both children. The image should then recalculate it's width to
&gt; preserve it's aspect ratio, which in turn will change its parent (absolute)
&gt; to change width. However, when relative's height is changed (via javascript
&gt; or the debugger) the widths are not properly updated. If relative's height
&gt; is decreased, no widths are recalculated and the image becomes squished
&gt; vertically. if relative's height is increased, the image's width is
&gt; increased to maintain the aspect ratio, but its parent (absolute) does not
&gt; increase width, causing the image to overflow and be displaced to the right
&gt; (in the example, it should stay centered).
&gt; 
&gt; Attached is an example page that shows this bug (also included in the
&gt; stackoverflow).</span >
You could add &quot;-webkit-aspect-ratio: from-intrinsic;&quot; to your img element to preserve ratio.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>