Bug 237665

Summary: [web-animations] font-variant-east-asian should support discrete animation
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, graouts, koivisto, mmaxfield, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar, WebExposed, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Antoine Quint
Reported 2022-03-09 10:07:08 PST
[web-animations] font-variant-east-asian should support discrete animation
Attachments
Patch (9.40 KB, patch)
2022-03-09 10:07 PST, Antoine Quint
no flags
Patch for landing (12.00 KB, patch)
2022-03-10 05:35 PST, Antoine Quint
no flags
Antoine Quint
Comment 1 2022-03-09 10:07:37 PST
Simon Fraser (smfr)
Comment 2 2022-03-09 11:31:32 PST
Comment on attachment 454257 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454257&action=review > Source/WebCore/animation/CSSPropertyAnimation.cpp:2526 > + bool canInterpolate(const RenderStyle&, const RenderStyle&, CompositeOperation) const override { return false; } final > Source/WebCore/animation/CSSPropertyAnimation.cpp:2528 > + bool equals(const RenderStyle& a, const RenderStyle& b) const override final > Source/WebCore/animation/CSSPropertyAnimation.cpp:2537 > + void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const override final > Source/WebCore/animation/CSSPropertyAnimation.cpp:2548 > + destination.setFontDescription(WTFMove(description)); > + destination.fontCascade().update(currentFontSelector); Other style settings on RenderStyle do the destination.setFontDescription() and fontCascade().update() thing internally. Can we be consistent?
Antoine Quint
Comment 3 2022-03-09 11:42:02 PST
(In reply to Simon Fraser (smfr) from comment #2) > Comment on attachment 454257 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=454257&action=review > > > Source/WebCore/animation/CSSPropertyAnimation.cpp:2548 > > + destination.setFontDescription(WTFMove(description)); > > + destination.fontCascade().update(currentFontSelector); > > Other style settings on RenderStyle do the destination.setFontDescription() > and fontCascade().update() thing internally. Can we be consistent? The difference here is that we need to set multiple members on the FontDescription rather than a single one, which I think is what the RenderStyle methods do. Since we need to set multiple fields for this property, this feels more efficient.
Simon Fraser (smfr)
Comment 4 2022-03-09 11:48:00 PST
Can we make a helper on RenderStyle that everyone uses?
Myles C. Maxfield
Comment 5 2022-03-09 16:55:17 PST
Comment on attachment 454257 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454257&action=review > Source/WebCore/animation/CSSPropertyAnimation.cpp:2547 > + ASSERT(!context.progress || context.progress == 1.0); > + auto& sourceFontDescription = (context.progress ? to : from).fontDescription(); > + > + FontSelector* currentFontSelector = destination.fontCascade().fontSelector(); > + auto description = destination.fontDescription(); > + description.setVariantEastAsianVariant(sourceFontDescription.variantEastAsianVariant()); > + description.setVariantEastAsianWidth(sourceFontDescription.variantEastAsianWidth()); > + description.setVariantEastAsianRuby(sourceFontDescription.variantEastAsianRuby()); > + destination.setFontDescription(WTFMove(description)); I'm confused. https://drafts.csswg.org/css-fonts/#font-variant-east-asian-prop says Animation type: discrete. Why do we need a blend function here but not in https://bugs.webkit.org/show_bug.cgi?id=237662?
Myles C. Maxfield
Comment 6 2022-03-09 16:57:30 PST
Comment on attachment 454257 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454257&action=review >> Source/WebCore/animation/CSSPropertyAnimation.cpp:2547 >> + destination.setFontDescription(WTFMove(description)); > > I'm confused. https://drafts.csswg.org/css-fonts/#font-variant-east-asian-prop says Animation type: discrete. Why do we need a blend function here but not in https://bugs.webkit.org/show_bug.cgi?id=237662? Oh, I see, it's because animations work at the RenderStyle layer, not the CSS layer, and in RenderStyle (FontDescription, actually) we have 3 separate pieces of state for this, so you can't use the built-in discrete infrastructure because it doesn't know that the 3 values need to be set together.
Myles C. Maxfield
Comment 7 2022-03-09 16:59:05 PST
r=me assuming you follow Simon's advice
Myles C. Maxfield
Comment 8 2022-03-09 17:00:19 PST
(In reply to Simon Fraser (smfr) from comment #4) > Can we make a helper on RenderStyle that everyone uses? This is a good idea but I don't think it should block these patches.
Antoine Quint
Comment 9 2022-03-10 05:35:28 PST
Created attachment 454341 [details] Patch for landing
EWS
Comment 10 2022-03-10 07:58:36 PST
Committed r291109 (248271@main): <https://commits.webkit.org/248271@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454341 [details].
Radar WebKit Bug Importer
Comment 11 2022-03-10 07:59:16 PST
Note You need to log in before you can comment on or make changes to this bug.