<?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>147185</bug_id>
          
          <creation_ts>2015-07-21 23:34:42 -0700</creation_ts>
          <short_desc>Webkit renders the alt text of images w/o src property and using width:auto incorrectly</short_desc>
          <delta_ts>2024-01-16 21:17:51 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Images</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>wkbugzilla</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>1266joules</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>gsnedders</cc>
    
    <cc>heycam</cc>
    
    <cc>peng.liu6</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>wkbugzilla</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1111216</commentid>
    <comment_count>0</comment_count>
      <attachid>257244</attachid>
    <who name="">wkbugzilla</who>
    <bug_when>2015-07-21 23:34:42 -0700</bug_when>
    <thetext>Created attachment 257244
Minimal html example reporting the img widths using js

When the src property of an img tag is missing, the alt text is displayed as expected. However, when a height is specified for the image and width:auto is applicable then the overall width of the element can be very large and is dependent on the length of the alt text and the height e.g. specifying a height=&quot;500&quot; with an alt string of 123 chars will result in an image element 18,136px wide - depending on base font size. 

The following img tags are identical except for height and the resulting element widths are 181, 1814 and 18136px respectively:

&lt;img height=&quot;5&quot; alt=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&quot; style=&quot;width:auto;&quot;&gt;
&lt;img height=&quot;50&quot; alt=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&quot; style=&quot;width:auto;&quot;&gt;
&lt;img height=&quot;500&quot; alt=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&quot; style=&quot;width:auto;&quot;&gt;

This occurs on Safari Version 8.0.6 (10600.6.3) on OS X 10.10.3 and the current Safari (and related UIWebView) version on iOS 8.4. 

Depending on the javascript techniques used on the site (e.g. setting parent.style.width = childImg.scrollWidth) this can cause iOS Safari+Webkit apps to crash.

Note that this does *not* occur if the src attribute is present but the actual image is not found. As per #62774 the alt text is not displayed at all but the resultant element is the correct size.

fwiw Chrome (Version 43.0.2357.134 (64-bit)) and Firefox (39.0) on OS X 10.10.3 and Chrome on iOS render the above img examples identically as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743991</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-03-25 16:48:25 -0700</bug_when>
    <thetext>Sounds like we&apos;re using the width of the line box as the intrinsic width.

https://html.spec.whatwg.org/multipage/rendering.html#images-3 is the relevant part of the HMTL spec, specifically with:

&gt; The user agent is expected to treat the element as a non-replaced phrasing element whose content is the text, optionally with an icon indicating that an image is missing, so that the user can request the image be displayed or investigate why it is not rendering. In non-graphical contexts, such an icon should be omitted.

where:

&gt; The icons mentioned above are expected to be relatively small so as not to disrupt most text but be easily clickable. In a visual environment, for instance, icons could be 16 pixels by 16 pixels square, or 1em by 1em if the images are scalable. In an audio environment, the icon could be a short bleep. The icons are intended to indicate to the user that they can be used to get to whatever options the UA provides for images, and, where appropriate, are expected to provide access to the context menu that would have come up if the user interacted with the actual image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1799937</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-10-03 17:23:08 -0700</bug_when>
    <thetext>The content of attachment 439998 has been deleted for the following reason:

spam/phishing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2005483</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-01-16 21:17:51 -0800</bug_when>
    <thetext>*** Safari 17.2.1 ***

Respective image widths are: 181, 1814, 18136

*** Chrome Canary 122 ***

Respective image widths are: 809, 809, 809

*** Firefox Nightly 123 ***

Respective image widths are: 793, 793, 793

____

Just wanted to share updated test results. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>257244</attachid>
            <date>2015-07-21 23:34:42 -0700</date>
            <delta_ts>2015-07-21 23:34:42 -0700</delta_ts>
            <desc>Minimal html example reporting the img widths using js</desc>
            <filename>minimal-img-example.html</filename>
            <type>text/html</type>
            <size>1250</size>
            <attacher>wkbugzilla</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij48
L21ldGE+CiAgICA8dGl0bGU+VGVzdCBtaXNzaW5nIGltYWdlIHNyYyBhbmQgbG9uZyBhbHQgdGV4
dDwvdGl0bGU+CjwvaGVhZD4KPGJvZHk+CiAgICA8cCBpZD0ib3V0cHV0Ij48L3A+CgogICAgPGRp
dj4KICAgICAgICA8aW1nIGhlaWdodD0iNSIgYWx0PSJMb3JlbSBpcHN1bSBkb2xvciBzaXQgYW1l
dCwgY29uc2VjdGV0dXIgYWRpcGlzY2luZyBlbGl0LCBz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ICAgICAgICAgIHRleHQgKz0gKyBhbGxJ
bWFnZXNbaV0ud2lkdGggKyAoIGkgPCBsZW4gLSAxID8gJywgJyA6ICcnICk7CiAgICAgICAgICAg
IH0KICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoICdvdXRwdXQnICkuaW5uZXJI
VE1MID0gdGV4dDsKICAgICAgICB9CgogICAgPC9zY3JpcHQ+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>