Bug 246914

Summary: [web-animations] commitStyles() fails to commit a relative line-height value
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, graouts, koivisto, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 222096    

Description Antoine Quint 2022-10-23 03:36:36 PDT
We fail this subtest in web-animations/interfaces/Animation/commitStyles.html:

test(t => {
  const div = createDiv(t);
  div.style.fontSize = '10px';

  const animation = div.animate(
    { lineHeight: '1.5' },
    { duration: 1, fill: 'forwards' }
  );
  animation.finish();
  animation.commitStyles();
  animation.cancel();

  assert_numeric_style_equals(getComputedStyle(div).lineHeight, 15);
  assert_equals(div.style.lineHeight, "1.5", "line-height is committed as a relative value");

  div.style.fontSize = '20px';
  assert_numeric_style_equals(getComputedStyle(div).lineHeight, 30,
      "Changes to the font-size should affect the committed line-height");

}, 'Commits relative line-height');

This is because of BuilderConverter::convertLineHeight() where a line-height specified as a percentage is stored as a LengthType::Fixed, while a line-height specified as number is stored as LengthType::Percent.

We'll somehow need to account for `specifiedLineHeight()`.
Comment 1 Antoine Quint 2022-10-23 04:13:09 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5685
Comment 2 Antoine Quint 2022-10-24 02:18:13 PDT
We'll need mix() support, I filed https://bugs.webkit.org/show_bug.cgi?id=246937. Retitling this bug to correctly identify the issue.
Comment 3 Antoine Quint 2022-10-24 02:22:05 PDT
Wrong bug about mix(), we have a fix for this.
Comment 4 EWS 2022-10-24 06:01:27 PDT
Committed 255912@main (1610fc726837): <https://commits.webkit.org/255912@main>

Reviewed commits have been landed. Closing PR #5685 and removing active labels.
Comment 5 Radar WebKit Bug Importer 2022-10-24 06:02:19 PDT
<rdar://problem/101497231>