Bug 222816

Summary: Improve blending of Length and other Length-related types
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
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=228811
Attachments:
Description Flags
Patch for EWS
none
Patch for EWS
none
Patch none

Description Antoine Quint 2021-03-05 12:25:32 PST
Improve blending of Length and other Length-related types
Comment 1 Antoine Quint 2021-03-05 12:25:58 PST
Created attachment 422394 [details]
Patch for EWS
Comment 2 Antoine Quint 2021-03-06 03:30:53 PST
Created attachment 422482 [details]
Patch for EWS
Comment 3 Antoine Quint 2021-03-06 06:32:14 PST
Created attachment 422490 [details]
Patch
Comment 4 Antoine Quint 2021-03-06 06:33:15 PST
*** Bug 222514 has been marked as a duplicate of this bug. ***
Comment 5 Antti Koivisto 2021-03-06 07:05:46 PST
Comment on attachment 422490 [details]
Patch

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

> Source/WebCore/animation/CSSPropertyAnimation.cpp:703
>  class LengthPropertyWrapper : public PropertyWrapperGetter<const Length&> {
>      WTF_MAKE_FAST_ALLOCATED;
>  public:
> -    LengthPropertyWrapper(CSSPropertyID prop, const Length& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length&&))
> +    enum class Flags {
> +        IsLengthPercentage          = 1 << 0,
> +        NegativeLengthsAreInvalid   = 1 << 1,
> +    };
> +    LengthPropertyWrapper(CSSPropertyID prop, const Length& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length&&), OptionSet<Flags> flags = { })

I think you could make the flags a template argument instead as they are fixed for a given property type.

Not sure if this has much practical significance though and could be done separately.

> Source/WebCore/animation/CSSPropertyAnimation.cpp:712
> -        return !this->value(a).isAuto() && !this->value(b).isAuto();
> +        return canInterpolateLengths(this->value(a), this->value(b), m_flags.contains(Flags::IsLengthPercentage));

Then canInterpolateLengths would also take IsLengthPercentage as template argument.
Comment 6 EWS 2021-03-06 08:28:32 PST
Committed r274038: <https://commits.webkit.org/r274038>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422490 [details].
Comment 7 Radar WebKit Bug Importer 2021-03-06 08:29:17 PST
<rdar://problem/75133641>