<?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>170834</bug_id>
          
          <creation_ts>2017-04-13 16:47:06 -0700</creation_ts>
          <short_desc>background-size with 2nd value is &apos;auto&apos; and the image has no intrinsic size and no intrinsic ratio incorrectly rendered</short_desc>
          <delta_ts>2024-12-01 19:28:40 -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>CSS</component>
          <version>Safari 10</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=243773</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, WPTImpact</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philippe Wittenbergh">phiw2</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>browserbugs2</cc>
    
    <cc>karlcow</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>tobi</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1297205</commentid>
    <comment_count>0</comment_count>
    <who name="Philippe Wittenbergh">phiw2</who>
    <bug_when>2017-04-13 16:47:06 -0700</bug_when>
    <thetext>Example URL:
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-one-value-percent-0xx.xht

Per CSS3 - backgrounds:
https://drafts.csswg.org/css-backgrounds/#the-background-size

For background-size:

&gt; [ &lt;length-percentage&gt; | auto ]{1,2}
&gt; The first value gives the width of the corresponding image, the second value its height. If only one value is given the second is assumed to be ‘auto’.

further, for “auto”, the text notes:

&gt; An ‘auto’ value for one dimension is resolved by using the image&apos;s intrinsic ratio and the size of the other dimension, or failing that, using the image&apos;s intrinsic size, or failing that, treating it as 100%.

For a gradient (as in the example), the “image” has no intrinsic size, thus 100% should be used. That is what Firefox / Gecko does.

Chrome and Safari are wrong.

one &lt;percent&gt; value

http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-one-value-percent-0xx.xht

or

one &lt;length&gt; value

http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-one-value-0xx.xht

What is the expected behavior?
Filled green square and no red

What went wrong?
sliver of green and large area of red


(related discussion on the CSS WG list: https://lists.w3.org/Archives/Public/www-style/2017Apr/thread.html#msg29</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1297208</commentid>
    <comment_count>1</comment_count>
    <who name="Philippe Wittenbergh">phiw2</who>
    <bug_when>2017-04-13 16:49:14 -0700</bug_when>
    <thetext>Equivalent Blink bug:
https://bugs.chromium.org/p/chromium/issues/detail?id=711489</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1297283</commentid>
    <comment_count>2</comment_count>
    <who name="Gérard Talbot (no longer involved)">browserbugs2</who>
    <bug_when>2017-04-13 20:01:32 -0700</bug_when>
    <thetext>2 additional tests with identical actual results (incorrect behaviors):

background-size: 10% auto;
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-percent-auto-no-intrinsic-0xx.xht


background-size: 10px auto;
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-length-auto-no-intrinsic-0xx.xht



2 additional tests with identical actual results (incorrect behaviors) *_using SVG image_* with no intrinsic ratio:

background-size: 10% auto;
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-percent-auto-no-intrinsic-0xy.xht

background-size: 10px auto;
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/draft-background-size-length-auto-no-intrinsic-0xy.xht</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1297710</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-04-15 17:41:35 -0700</bug_when>
    <thetext>&lt;rdar://problem/31646443&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1301570</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2017-04-26 07:28:52 -0700</bug_when>
    <thetext>Need to fix RenderBoxModelObject::calculateFillTileSize) which calls RenderBoxModelObject::calculateImageIntrinsicDimensions() which has this:

    // A generated image without a fixed size, will always return the container size as intrinsic size.
    if (image-&gt;isGeneratedImage() &amp;&amp; image-&gt;usesImageContainerSize())</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1305307</commentid>
    <comment_count>5</comment_count>
    <who name="Gérard Talbot (no longer involved)">browserbugs2</who>
    <bug_when>2017-05-05 14:13:29 -0700</bug_when>
    <thetext>The summary (title) of this bug report should say *_background-size_* and not background-position! All 6 tests mentioned in this bug report are testing and were indeed testing *_background-size_* and not background-position. So, I tuned accordingly the text in the 6 tests and I updated the summary text of this bug report.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1423529</commentid>
    <comment_count>6</comment_count>
    <who name="Tobi Reif">tobi</who>
    <bug_when>2018-05-14 01:20:20 -0700</bug_when>
    <thetext>It would be great if this could get fixed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1864437</commentid>
    <comment_count>7</comment_count>
    <who name="Gérard Talbot (no longer involved)">browserbugs2</who>
    <bug_when>2022-04-26 07:23:27 -0700</bug_when>
    <thetext>Related links
- - - - - - -

Added 4 background-size (with no intrinsic and no ratio) tests
https://github.com/web-platform-tests/wpt/pull/26599


http://wpt.live/css/css-backgrounds/background-size-041.html

https://wpt.fyi/results/css/css-backgrounds/background-size-041.html?label=experimental&amp;label=master&amp;aligned


http://wpt.live/css/css-backgrounds/background-size-042.html

https://wpt.fyi/results/css/css-backgrounds/background-size-042.html?label=experimental&amp;label=master&amp;aligned


http://wpt.live/css/css-backgrounds/background-size-043.html

https://wpt.fyi/results/css/css-backgrounds/background-size-043.html?label=experimental&amp;label=master&amp;aligned


http://wpt.live/css/css-backgrounds/background-size-044.html

https://wpt.fyi/results/css/css-backgrounds/background-size-044.html?label=experimental&amp;label=master&amp;aligned</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2077826</commentid>
    <comment_count>8</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-11-26 22:05:07 -0800</bug_when>
    <thetext>Only 43, and 44 are marked as FAIL in Safari currently.

http://wpt.live/css/css-backgrounds/background-size-043.html
https://wpt.fyi/results/css/css-backgrounds/background-size-043.html?label=experimental&amp;label=master&amp;aligned


http://wpt.live/css/css-backgrounds/background-size-044.html
https://wpt.fyi/results/css/css-backgrounds/background-size-044.html?label=experimental&amp;label=master&amp;aligned</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2078396</commentid>
    <comment_count>9</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-12-01 19:28:40 -0800</bug_when>
    <thetext>https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/rendering/RenderBoxModelObject.cpp#787-789

    // A generated image without a fixed size, will always return the container size as intrinsic size.
    if (!image-&gt;imageHasNaturalDimensions())
        return LayoutSize(positioningAreaSize.width(), positioningAreaSize.height());

Probably should be testing for SVGElement and intrisic sizing too. 
https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGSVGElement.cpp#639</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>