<?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>251911</bug_id>
          
          <creation_ts>2023-02-08 02:27:27 -0800</creation_ts>
          <short_desc>[web-animations] line-height should not transition from default value to a number</short_desc>
          <delta_ts>2023-02-08 12:34:09 -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>Animations</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/38416</see_also>
          <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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Antoine Quint">graouts</reporter>
          <assigned_to name="Antoine Quint">graouts</assigned_to>
          <cc>dino</cc>
    
    <cc>graouts</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1931969</commentid>
    <comment_count>0</comment_count>
      <attachid>464906</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 02:27:27 -0800</bug_when>
    <thetext>Created attachment 464906
Reduction

We incorrectly interpolate the &quot;line-height&quot; property when it animates from its initial value (normal) to a number. This was reported in https://stackoverflow.com/questions/75151629/css-transitions-in-safari/.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931970</commentid>
    <comment_count>1</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 02:27:47 -0800</bug_when>
    <thetext>rdar://104346766</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931972</commentid>
    <comment_count>2</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 02:33:24 -0800</bug_when>
    <thetext>The problem is that BuilderConverter::convertLineHeight() loses the `&lt;number&gt;` type here:

    if (primitiveValue.isNumber())
        return Length(primitiveValue.doubleValue() * 100.0, LengthType::Percent);

Additionally, the `normal` value is also converted to a percent value here:

    if (valueID == CSSValueNormal)
        return RenderStyle::initialLineHeight();

Where RenderStyle::initialLineHeight() builds this value:

    // Returning -100% percent here means the line-height is not set.
    static Length initialLineHeight() { return Length(-100.0f, LengthType::Percent); }

This means that when we get to deciding whether it&apos;s OK to interpolate between `normal` and `0`, which is what the original Stack Overflow example does, we consider two percent values and decide it&apos;s OK to interpolate.

We are going to need to:

1. identify the `normal` value with special logic
2. preserve the `number` type somehow

Finally, looking at the spec for `line-height` I see it takes in `&lt;length-percentage&gt;` as a value and yet the animation wrapper does not specify this. So there&apos;s likely another bug here where we would fail to yield a transition between &quot;line-height: 10px&quot; and &quot;line-height: 10%&quot; I expect.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931973</commentid>
    <comment_count>3</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 02:38:01 -0800</bug_when>
    <thetext>Actually, a transition between &quot;line-height: 10px&quot; and &quot;line-height: 10%&quot; works because we convert the &quot;10%&quot; to a Fixed value as well so we end up having the same type. This code is pretty weird :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931978</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 03:16:00 -0800</bug_when>
    <thetext>Alright, so all we need to do is to have a custom `canInterpolate()` override for `line-height` and return false if any value maps to RenderStyle::initialLineHeight(). The default LengthPropertyWrapper logic will otherwise apply since &lt;number&gt; values map to LengthType::Percent and &lt;length-percentage&gt; values map to LengthType::Fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931983</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 04:55:26 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/9807</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931984</commentid>
    <comment_count>6</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2023-02-08 04:55:53 -0800</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/38416</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1932109</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-02-08 12:34:04 -0800</bug_when>
    <thetext>Committed 260028@main (221eb1d58b67): &lt;https://commits.webkit.org/260028@main&gt;

Reviewed commits have been landed. Closing PR #9807 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>464906</attachid>
            <date>2023-02-08 02:27:27 -0800</date>
            <delta_ts>2023-02-08 02:27:27 -0800</delta_ts>
            <desc>Reduction</desc>
            <filename>line-height-transition-from-default-to-number.html</filename>
            <type>text/html</type>
            <size>424</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">PHN0eWxlPgoKICAgIGRpdiB7CiAgICAgICAgdHJhbnNpdGlvbjogbGluZS1oZWlnaHQgMXM7CiAg
ICB9CgogICAgZGl2LmNoYW5nZWQgewogICAgICAgIGxpbmUtaGVpZ2h0OiA1OwogICAgfQoKPC9z
dHlsZT4KCjxkaXY+PC9kaXY+Cgo8c2NyaXB0PgoKY29uc3QgdGFyZ2V0ID0gZG9jdW1lbnQucXVl
cnlTZWxlY3RvcigiZGl2Iik7CnNldFRpbWVvdXQoKCkgPT4gewogICAgdGFyZ2V0LmNsYXNzTmFt
ZSA9ICJjaGFuZ2VkIjsKICAgIGNvbnNvbGUubG9nKGBudW1iZXIgb2YgcnVubmluZyBhbmltYXRp
b25zID0gJHtkb2N1bWVudC5nZXRBbmltYXRpb25zKCkubGVuZ3RofWApOwogICAgY29uc29sZS5s
b2coYGNvbXB1dGVkIGxpbmUtaGVpZ2h0ID0gJHtnZXRDb21wdXRlZFN0eWxlKHRhcmdldCkubGlu
ZUhlaWdodH1gKTsKfSkKCjwvc2NyaXB0Pg==
</data>

          </attachment>
      

    </bug>

</bugzilla>