<?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>233032</bug_id>
          
          <creation_ts>2021-11-12 01:11:51 -0800</creation_ts>
          <short_desc>Percentage size inside a fit-content parent in quirk mode</short_desc>
          <delta_ts>2024-07-25 09:03:42 -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>CSS</component>
          <version>WebKit Local 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>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="cathiechen">cathiechen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1814370</commentid>
    <comment_count>0</comment_count>
    <who name="cathiechen">cathiechen</who>
    <bug_when>2021-11-12 01:11:51 -0800</bug_when>
    <thetext>We found the behavior of the following case is different in browsers.
The img and div size is 1x1 in Chrome.
While the img and div size is 1xA in Safari and FireFox, where A is the screen height.

Test case:
```
&lt;div style=&quot;width:fit-content;height:fit-content;&quot;&gt;
    &lt;img style=&quot;width: 100%; height: 100%&quot; src=&quot;https://w3c-test.org/images/green-1x1.png&quot;/&gt;
&lt;/div&gt;
```
Or open https://output.jsbin.com/nodecov/quiet


We have discussed this in https://bugs.chromium.org/p/chromium/issues/detail?id=1268427

According to https://quirks.spec.whatwg.org/#the-percentage-height-calculation-quirk
The containing block is DIV.
Then according to https://www.w3.org/TR/CSS22/visudet.html#the-height-property
&gt; If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the used height is calculated as if &apos;auto&apos; was specified.

So the height of IMG is “Behaving as auto” (https://drafts.csswg.org/css-sizing-3/#behave-auto)
So the IMG size should be 1x1, so as to DIV&apos;s.

WDYT? Do we need a consistent here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1816775</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-11-19 01:12:20 -0800</bug_when>
    <thetext>&lt;rdar://problem/85591164&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2048341</commentid>
    <comment_count>2</comment_count>
      <attachid>471965</attachid>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-07-25 09:03:24 -0700</bug_when>
    <thetext>Created attachment 471965
Test Case</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>471965</attachid>
            <date>2024-07-25 09:03:24 -0700</date>
            <delta_ts>2024-07-25 09:03:24 -0700</delta_ts>
            <desc>Test Case</desc>
            <filename>Test Case - Quirk - Fit-Content.html</filename>
            <type>text/html</type>
            <size>157</size>
            <attacher name="Ahmad Saleem">ahmad.saleem792</attacher>
            
              <data encoding="base64">PGRpdiBpZD0icGFyZW50IiBzdHlsZT0id2lkdGg6Zml0LWNvbnRlbnQ7aGVpZ2h0OmZpdC1jb250
ZW50OyI+CiAgICA8aW1nIGlkPSJjaGlsZCIgc3R5bGU9IndpZHRoOiAxMDAlOyBoZWlnaHQ6IDEw
MCUiIHNyYz0iaHR0cHM6Ly9wbGFjZWhvbGQuY28vMVgxIi8+CjwvZGl2Pg==
</data>

          </attachment>
      

    </bug>

</bugzilla>