Bug 224670 - Blend using calc() when necessary
Summary: Blend using calc() when necessary
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks: 223875
  Show dependency treegraph
 
Reported: 2021-04-16 06:27 PDT by Antoine Quint
Modified: 2021-04-24 15:09 PDT (History)
4 users (show)

See Also:


Attachments
Patch (137.31 KB, patch)
2021-04-16 06:37 PDT, Antoine Quint
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2021-04-16 06:27:53 PDT
Blend using calc() with 0 values
Comment 1 Antoine Quint 2021-04-16 06:37:52 PDT
Created attachment 426218 [details]
Patch
Comment 2 Antti Koivisto 2021-04-16 07:00:41 PDT
Comment on attachment 426218 [details]
Patch

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

> Source/WebCore/animation/CSSPropertyAnimation.cpp:851
> +        if (!canInterpolate(from, to))
> +            (destination->*m_setter)(progress ? LengthBox(value(to)) : LengthBox(value(from)));
> +        else {

You could early return instead of having an else branch.

> Source/WebCore/platform/LengthBox.h:61
> +    LengthBox(const LengthBox& box)
> +        : RectEdges { Length(box.top()), Length(box.right()), Length(box.bottom()), Length(box.left()) }
> +    {
> +    }
> +

I guess you also just give both RectEdges and LengthBox defaulted copy constructors.
Comment 3 Antoine Quint 2021-04-16 08:46:33 PDT
Committed r276138 (236632@main): <https://commits.webkit.org/236632@main>
Comment 4 Antoine Quint 2021-04-16 09:48:37 PDT
(In reply to Antti Koivisto from comment #2)
> Comment on attachment 426218 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=426218&action=review
> 
> > Source/WebCore/animation/CSSPropertyAnimation.cpp:851
> > +        if (!canInterpolate(from, to))
> > +            (destination->*m_setter)(progress ? LengthBox(value(to)) : LengthBox(value(from)));
> > +        else {
> 
> You could early return instead of having an else branch.

Good point, made the change in the landed patch.

> > Source/WebCore/platform/LengthBox.h:61
> > +    LengthBox(const LengthBox& box)
> > +        : RectEdges { Length(box.top()), Length(box.right()), Length(box.bottom()), Length(box.left()) }
> > +    {
> > +    }
> > +
> 
> I guess you also just give both RectEdges and LengthBox defaulted copy
> constructors.

Yes, that's the approach I took in the landed patch.
Comment 5 Radar WebKit Bug Importer 2021-04-24 15:09:47 PDT
<rdar://problem/77110128>