<?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>259551</bug_id>
          
          <creation_ts>2023-07-27 05:15:25 -0700</creation_ts>
          <short_desc>[CSS Fonts] The `from-font` value for CSS `font-size-adjust` is not computed correctly</short_desc>
          <delta_ts>2023-10-07 07:54:03 -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>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>262285</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Kew">jfkthame</reporter>
          <assigned_to name="ChangSeok Oh">changseok</assigned_to>
          <cc>changseok</cc>
    
    <cc>commit-queue</cc>
    
    <cc>emilio</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>ntim</cc>
    
    <cc>vitor.roriz</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1968417</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Kew">jfkthame</who>
    <bug_when>2023-07-27 05:15:25 -0700</bug_when>
    <thetext>Support for the `from-font` value was implemented in https://bugs.webkit.org/show_bug.cgi?id=254790, but does not behave according to the spec.

The current spec[1] says that the computed value of `font-size-adjust` is

    the keyword none, or a pair of a metric keyword and a &lt;number&gt;

and for the `from-font` keyword[2] it confirms that this

    Computes to the &lt;number&gt; corresponding to the specified metric of the first available font.

However, in Safari Tech Preview[3] I&apos;m seeing `from-font` retained as the computed value. This results in incorrect behavior, because when inherited by a child element, it may then resolve to different numbers depending on the font of the child (instead of inheriting the number computed from the metrics of the font on the element where it was specified).

In addition, it appears that the value is not being resolved using the metrics of the first available font *of the element where `font-size-adjust` was specified*, but rather using metrics from the parent element. This can be seen in the demo at https://codepen.io/jfkthame/pen/NWEMaaG, where the use of `from-font` gives different results depending on the font family of the containing block, instead of being computed from the paragraph&apos;s own first available font.

See also https://github.com/w3c/csswg-drafts/issues/9050.

[1] https://drafts.csswg.org/css-fonts-5/#font-size-adjust-prop
[2] https://drafts.csswg.org/css-fonts-5/#valdef-font-size-adjust-from-font
[3] Release 171 (Safari 16.4, WebKit 18616.1.15)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969434</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-03 05:16:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/113328110&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969453</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-08-03 09:59:09 -0700</bug_when>
    <thetext>WPTs are at https://github.com/web-platform-tests/wpt/pull/41273 (thanks Jonathan!)

The computed style is a trivial fix, and using the correct font probably is as well, currently doing some local testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969668</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-08-04 09:54:44 -0700</bug_when>
    <thetext>This requires a bit more work than expected to use the current element&apos;s style, since the fonts are not initialized at the moment we compute the size-adjust value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1970195</commentid>
    <comment_count>4</comment_count>
    <who name="ChangSeok Oh">changseok</who>
    <bug_when>2023-08-08 16:42:49 -0700</bug_when>
    <thetext>(In reply to Tim Nguyen (:ntim) from comment #3)
&gt; This requires a bit more work than expected to use the current element&apos;s
&gt; style, since the fonts are not initialized at the moment we compute the
&gt; size-adjust value.

Yes. That is why the parent element&apos;s font instead. I will take a look at the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1979981</commentid>
    <comment_count>5</comment_count>
    <who name="ChangSeok Oh">changseok</who>
    <bug_when>2023-09-25 15:26:19 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/18193</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1980727</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-09-27 17:28:48 -0700</bug_when>
    <thetext>Committed 268550@main (49f5188b5e82): &lt;https://commits.webkit.org/268550@main&gt;

Reviewed commits have been landed. Closing PR #18193 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1980861</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2023-09-28 00:17:18 -0700</bug_when>
    <thetext>Re-opened since this is blocked by bug 262285</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1981355</commentid>
    <comment_count>8</comment_count>
    <who name="ChangSeok Oh">changseok</who>
    <bug_when>2023-09-29 12:11:06 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/18425</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1983456</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-10-07 07:54:01 -0700</bug_when>
    <thetext>Committed 269041@main (89bdb0336c3b): &lt;https://commits.webkit.org/269041@main&gt;

Reviewed commits have been landed. Closing PR #18425 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>