Bug 224730 - Fix interpolation of the rotate CSS property
Summary: Fix interpolation of the rotate CSS property
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: 223876
  Show dependency treegraph
 
Reported: 2021-04-18 01:59 PDT by Antoine Quint
Modified: 2021-04-24 15:05 PDT (History)
5 users (show)

See Also:


Attachments
Patch (52.90 KB, patch)
2021-04-18 02:02 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (71.19 KB, patch)
2021-04-18 02:51 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (71.24 KB, patch)
2021-04-18 10:04 PDT, Antoine Quint
no flags 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-18 01:59:49 PDT
Fix interpolation of the rotate CSS property
Comment 1 Antoine Quint 2021-04-18 02:02:34 PDT
Created attachment 426375 [details]
Patch
Comment 2 Antoine Quint 2021-04-18 02:51:18 PDT
Created attachment 426376 [details]
Patch
Comment 3 Dean Jackson 2021-04-18 08:58:20 PDT
Comment on attachment 426376 [details]
Patch

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

> Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp:66
> +        auto x = static_cast<float>(op.m_x);
> +        auto y = static_cast<float>(op.m_y);
> +        auto z = static_cast<float>(op.m_z);
> +        auto length = std::hypot(x, y, z);
> +        return { x / length, y / length, z / length };

Use simd.h here.

auto v = simd_make_float3(static_cast<float>(op.m_x), static_cast<float>(op.m_y), static_cast<float>(op.m_z));
auto normalized = simd_normalize(v);
return { normalized.x, normalized.y, normalized.z };

Although you might also be able to use simd things through the whole function and avoid FloatPoint3D.
Comment 4 Dean Jackson 2021-04-18 08:58:53 PDT
simd stuff is apple-specific
Comment 5 Dean Jackson 2021-04-18 09:00:16 PDT
... maybe. other platforms might have versions. And I think it's becoming part of the C++ stdlib. Ask weinig.
Comment 6 Dean Jackson 2021-04-18 09:01:29 PDT
Another option would be to add a normalize fn to FloatPoint3D.
Comment 7 Antoine Quint 2021-04-18 09:43:36 PDT
(In reply to Dean Jackson from comment #6)
> Another option would be to add a normalize fn to FloatPoint3D.

There actually is one :)
Comment 8 Antoine Quint 2021-04-18 10:04:11 PDT
Created attachment 426379 [details]
Patch for landing
Comment 9 EWS 2021-04-18 11:12:31 PDT
Committed r276231 (236713@main): <https://commits.webkit.org/236713@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426379 [details].
Comment 10 Radar WebKit Bug Importer 2021-04-24 15:05:50 PDT
<rdar://problem/77110066>