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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23581</bug_id>
          
          <creation_ts>2013-10-21 12:38:08 +0000</creation_ts>
          <short_desc>The case when @src refers to a image without intrinsic width/height (SVG) is undefined.</short_desc>
          <delta_ts>2016-02-05 08:02:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Image Values and Replaced Content</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#dom-img-naturalwidth</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Tab Atkins Jr.">jackalmage</assigned_to>
          <cc>davve</cc>
    
    <cc>fantasai.bugs</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>kennyluck</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94998</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-10-21 12:38:08 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html
Multipage: http://www.whatwg.org/C#dom-img-naturalwidth
Complete: http://www.whatwg.org/c#dom-img-naturalwidth
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
The case when @src refers to a image without intrinsic width/height (SVG) is
undefined.

Posted from: 219.236.246.147 by kennyluck@csail.mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95020</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-21 16:14:25 +0000</bug_when>
    <thetext>Looks like I need to pass CSS Images a flag that says the default object size is 100% of the containing block width, or something. But it has to take into account margins and padding. 

   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2575
   http://dev.w3.org/csswg/css-images-3/#concrete-object-size</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95045</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-21 21:08:18 +0000</bug_when>
    <thetext>This&apos;ll probably need changes to the HTML rendering section to set some flag or something, but for now, the CSS side of this needs to be adjusted first. Punting to Tab as per discussion on IRC for now. Please send it back when you&apos;re ready for something on the HTML side. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124847</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2016-02-04 18:08:39 +0000</bug_when>
    <thetext>David, what do implementations actually do?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124854</commentid>
    <comment_count>4</comment_count>
    <who name="David Vest">davve</who>
    <bug_when>2016-02-05 07:31:48 +0000</bug_when>
    <thetext>What Blink (and WebKit unless they have changed it recently) does is
pretty broken.

For naturalWidth and naturalHeight, a default 300x150 size is
hard-coded in the svg specific &lt;img&gt; code (yes, separate from the
usual CSS mechanics) and used as a fallback size in case of missing
intrinsic width or height.

In general, the Blink code doesn&apos;t handle images with empty sizes well
(a legacy from raster-only images, empty sized images are null and
basically in error), so I presume that&apos;s why someone chose 300x150 as
a better size than nothing.

Also, post-fork, Blink has added resolving missing width and height
using the aspect ratio (from viewBox, if any) in a step towards the
default sizing algorithm. I&apos;m not sure WebKit has that.

See
third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/image-natural-width-height-svg.html[1]
in chromium repo for an example how it manifests. I can only guess
what Firefox does, but they pass the mentioned test.

[1] https://chromium.googlesource.com/chromium/blink/+/72fef91ac1ef679207f51def8133b336a6f6588f/LayoutTests/fast/dom/HTMLImageElement/image-natural-width-height-svg.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124855</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2016-02-05 08:02:44 +0000</bug_when>
    <thetext>So, how should this all be spec&apos;d ideally? Do we have use counters suggesting that it needs to do something sane? If not, could it be treated as an error so that not even people making 300x150 images can neglect to set up a viewBox?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>