<?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>249726</bug_id>
          
          <creation_ts>2022-12-21 10:03:02 -0800</creation_ts>
          <short_desc>Setting `font-weight` property to 3.14 returns 3 as computed value instead of 3.14</short_desc>
          <delta_ts>2022-12-22 22:40:56 -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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>175733</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>darin</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1921123</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2022-12-21 10:03:02 -0800</bug_when>
    <thetext>FontSelectionValue is not able to store 3.14. FontSelectionValue::float() returns 3 after storing 3.14.

This causes our Web-facing behavior to differ from Chrome and Firefox for the `font-stretch` CSS property and is causing the following WPT test to fail:
imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921124</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2022-12-21 10:05:46 -0800</bug_when>
    <thetext>The code says:
// Since floats have 23 mantissa bits, every value can be represented losslessly.
constexpr operator float() const;

So I expect the loss of precision is not intentional.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921129</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2022-12-21 10:12:28 -0800</bug_when>
    <thetext>Seems the class uses a int16_t to store the float, after multiplying by fractionalEntropy (which is 4). Then when requesting the float back, it just divides the int16_t by 4. We end up with a precision of 0.25% as a result.

So if I store 3.14%, I get 3% back. But if I store 3.25%, I get 3.25% back.

This loss in precision doesn&apos;t match other browsers and is Web-observable since computed values are exposed to the Web.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921214</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2022-12-21 14:06:44 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/7976</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921392</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2022-12-22 09:23:29 -0800</bug_when>
    <thetext>Actually, our behavior seems to match Blink at least.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>