Bug 236480 - [css-transforms] properly handle interpolation of non-invertible matrices
Summary: [css-transforms] properly handle interpolation of non-invertible matrices
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nikos Mouchtaris
URL:
Keywords: InRadar
: 235781 (view as bug list)
Depends on:
Blocks: 232082
  Show dependency treegraph
 
Reported: 2022-02-10 19:25 PST by Nikos Mouchtaris
Modified: 2022-02-16 01:48 PST (History)
4 users (show)

See Also:


Attachments
Patch (16.10 KB, patch)
2022-02-10 19:32 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (16.27 KB, patch)
2022-02-10 22:43 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (17.15 KB, patch)
2022-02-10 23:07 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (21.64 KB, patch)
2022-02-11 11:52 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (24.81 KB, patch)
2022-02-11 15:49 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (24.98 KB, patch)
2022-02-14 13:13 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (21.75 KB, patch)
2022-02-14 15:10 PST, Nikos Mouchtaris
mrobinson: review+
Details | Formatted Diff | Diff
Patch (21.54 KB, patch)
2022-02-15 11:41 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Mouchtaris 2022-02-10 19:25:38 PST
Web animations- properly handle interpolation of non-invertible matrices
Comment 1 Nikos Mouchtaris 2022-02-10 19:32:09 PST
Created attachment 451633 [details]
Patch
Comment 2 Nikos Mouchtaris 2022-02-10 22:43:45 PST
Created attachment 451642 [details]
Patch
Comment 3 Nikos Mouchtaris 2022-02-10 23:07:16 PST
Created attachment 451646 [details]
Patch
Comment 4 Martin Robinson 2022-02-11 03:18:38 PST
Comment on attachment 451646 [details]
Patch

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

This looks pretty good to me. I had a couple comments, but I really like the WPT progression!

> Source/WebCore/platform/graphics/transforms/TransformOperations.cpp:85
> +    if ((from.hasMatrixOperation() || hasMatrixOperation()) && (!from.isInvertible(boxSize) || !isInvertible(boxSize))) {

There are some non-matrix operations that lead to uninvertible transformation matrices. Do they also need to follow this code path? The specification mentions "scale(0)."

> Source/WebCore/platform/graphics/transforms/TransformOperations.h:66
> +        for (const auto& operation : m_operations) {

I think this might be a good candidate for using `any_of` from the standard library.
Comment 5 Nikos Mouchtaris 2022-02-11 11:52:15 PST
Created attachment 451733 [details]
Patch
Comment 6 Nikos Mouchtaris 2022-02-11 11:54:04 PST
(In reply to Martin Robinson from comment #4)
> Comment on attachment 451646 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=451646&action=review
> 
> This looks pretty good to me. I had a couple comments, but I really like the
> WPT progression!
> 
> > Source/WebCore/platform/graphics/transforms/TransformOperations.cpp:85
> > +    if ((from.hasMatrixOperation() || hasMatrixOperation()) && (!from.isInvertible(boxSize) || !isInvertible(boxSize))) {
> 
> There are some non-matrix operations that lead to uninvertible
> transformation matrices. Do they also need to follow this code path? The
> specification mentions "scale(0)."
> 
From my understanding of this line in the spec I don't think so: 
Note: Animations to or from the neutral element of additions <matrix()>, matrix3d() and perspective() fall back to discrete animations

> > Source/WebCore/platform/graphics/transforms/TransformOperations.h:66
> > +        for (const auto& operation : m_operations) {
> 
> I think this might be a good candidate for using `any_of` from the standard
> library.
Fixed.
Comment 7 Nikos Mouchtaris 2022-02-11 15:49:59 PST
Created attachment 451753 [details]
Patch
Comment 8 Nikos Mouchtaris 2022-02-14 13:13:05 PST
Created attachment 451934 [details]
Patch
Comment 9 Nikos Mouchtaris 2022-02-14 15:10:08 PST
Created attachment 451945 [details]
Patch
Comment 10 Martin Robinson 2022-02-15 01:27:53 PST
Comment on attachment 451945 [details]
Patch

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

Looks good to me, with a couple nits.

> Source/WebCore/platform/graphics/transforms/TransformOperations.cpp:99
> +bool TransformOperations::shouldFallbackToDiscreteAnimation(const TransformOperations& from, const LayoutSize& boxSize) const

Super nit: Fallback => FallBack because "fall back" is the verb form and "fallback" is the noun.

> Source/WebCore/platform/graphics/transforms/TransformOperations.h:66
> +        return std::any_of(m_operations.begin(), m_operations.end(), [](RefPtr<TransformOperation> op) {

Hrm. Can RefPtr<TransformOperation> be replaced with auto? I would use "operation" instead of "op" here, because "op" can also mean operand.
Comment 11 Nikos Mouchtaris 2022-02-15 11:41:24 PST
Created attachment 452068 [details]
Patch
Comment 12 Nikos Mouchtaris 2022-02-15 13:58:05 PST
(In reply to Martin Robinson from comment #10)
> Comment on attachment 451945 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=451945&action=review
> 
> Looks good to me, with a couple nits.
> 
> > Source/WebCore/platform/graphics/transforms/TransformOperations.cpp:99
> > +bool TransformOperations::shouldFallbackToDiscreteAnimation(const TransformOperations& from, const LayoutSize& boxSize) const
> 
> Super nit: Fallback => FallBack because "fall back" is the verb form and
> "fallback" is the noun.
Fixed.
> 
> > Source/WebCore/platform/graphics/transforms/TransformOperations.h:66
> > +        return std::any_of(m_operations.begin(), m_operations.end(), [](RefPtr<TransformOperation> op) {
> 
> Hrm. Can RefPtr<TransformOperation> be replaced with auto? I would use
> "operation" instead of "op" here, because "op" can also mean operand.
Fixed.
Comment 13 EWS 2022-02-15 16:27:36 PST
Committed r289862 (247302@main): <https://commits.webkit.org/247302@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 452068 [details].
Comment 14 Radar WebKit Bug Importer 2022-02-15 16:28:16 PST
<rdar://problem/88994181>
Comment 15 Antoine Quint 2022-02-16 01:48:55 PST
*** Bug 235781 has been marked as a duplicate of this bug. ***