Bug 237371

Summary: [web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, graouts, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar, WebExposed, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 237471    
Attachments:
Description Flags
Patch
none
Patch koivisto: review+, koivisto: commit-queue-

Description Antoine Quint 2022-03-02 08:31:26 PST
[web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
Comment 1 Antoine Quint 2022-03-02 08:33:08 PST
Created attachment 453615 [details]
Patch
Comment 2 Antti Koivisto 2022-03-02 09:13:40 PST
Comment on attachment 453615 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453615&action=review

> Source/WebCore/animation/KeyframeEffect.cpp:786
> +            if (value.contains("inherit"))

What happens if the value is "finherit"? Shouldn't the test here be for exact equality with "inherit"?
Comment 3 Antoine Quint 2022-03-02 09:18:29 PST
(In reply to Antti Koivisto from comment #2)
> Comment on attachment 453615 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=453615&action=review
> 
> > Source/WebCore/animation/KeyframeEffect.cpp:786
> > +            if (value.contains("inherit"))
> 
> What happens if the value is "finherit"? Shouldn't the test here be for
> exact equality with "inherit"?

Only properties that have been successfully parsed made it this far in the code, so "finherit" would have been rejected.
Comment 4 Antoine Quint 2022-03-02 09:19:15 PST
However, I think we can expect to see "inherit" in a list of values, hence the contains().
Comment 5 Antti Koivisto 2022-03-02 09:23:34 PST
> Only properties that have been successfully parsed made it this far in the
> code, so "finherit" would have been rejected.

I guess I don't understand what these values are. Many properties take arbitrary strings as values (say, urls).
Comment 6 Antti Koivisto 2022-03-02 09:25:49 PST
(In reply to Antoine Quint from comment #4)
> However, I think we can expect to see "inherit" in a list of values, hence
> the contains().

Can' you give an example of "inherit" on a list?
Comment 7 Antoine Quint 2022-03-03 07:58:46 PST
(In reply to Antti Koivisto from comment #6)
> (In reply to Antoine Quint from comment #4)
> > However, I think we can expect to see "inherit" in a list of values, hence
> > the contains().
> 
> Can' you give an example of "inherit" on a list?

I can't actually think of one, it was more theoretical for CSSValueList. I will however add a check for CSSProperty::isInheritedProperty().
Comment 8 Antoine Quint 2022-03-03 08:03:20 PST
Created attachment 453739 [details]
Patch
Comment 9 Antti Koivisto 2022-03-03 10:28:38 PST
Comment on attachment 453739 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453739&action=review

> Source/WebCore/animation/KeyframeEffect.cpp:788
> +        for (auto& [property, value] : keyframe.styleStrings) {
> +            if (CSSProperty::isInheritedProperty(property) && value == "inherit")
> +                m_inheritedProperties.add(property);
> +        }

Shouldn't this be || rather than &&?
Comment 10 Antti Koivisto 2022-03-03 10:32:31 PST
Comment on attachment 453739 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453739&action=review

>> Source/WebCore/animation/KeyframeEffect.cpp:788
>> +        }
> 
> Shouldn't this be || rather than &&?

also equalLettersIgnoringASCIICase(value, "inherit")
Comment 11 Antoine Quint 2022-03-04 00:53:49 PST
Committed r290823 (248059@trunk): <https://commits.webkit.org/248059@trunk>
Comment 12 Radar WebKit Bug Importer 2022-03-04 00:54:16 PST
<rdar://problem/89802010>
Comment 13 Antoine Quint 2022-03-04 06:48:43 PST
(In reply to Antti Koivisto from comment #9)
> Comment on attachment 453739 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=453739&action=review
> 
> > Source/WebCore/animation/KeyframeEffect.cpp:788
> > +        for (auto& [property, value] : keyframe.styleStrings) {
> > +            if (CSSProperty::isInheritedProperty(property) && value == "inherit")
> > +                m_inheritedProperties.add(property);
> > +        }
> 
> Shouldn't this be || rather than &&?

Actually, use of CSSProperty::isInheritedProperty() is completely wrong here. It doesn't matter where a property on a keyframe is inherited, it matters that it uses the "inherit" keyword.