Skip to content

LibWeb: Interpolate axis-keyword and calculated rotate values - #11087

Open
tcl3 wants to merge 1 commit into
LadybirdBrowser:masterfrom
tcl3:libweb_rotate_interpolation_fix
Open

LibWeb: Interpolate axis-keyword and calculated rotate values#11087
tcl3 wants to merge 1 commit into
LadybirdBrowser:masterfrom
tcl3:libweb_rotate_interpolation_fix

Conversation

@tcl3

@tcl3 tcl3 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Interpolation of the rotate property only handled the bare angle and numeric axis forms. The x, y, and z axis keyword forms fell back to discrete interpolation. Arguments containing math functions did the same. Normalize the axis keyword forms to their rotate3d axis vectors. Resolve calculated angle and axis arguments before interpolating. The same resolution now applies to rotate3d pairs in transform lists.

This makes the rotate buttons on https://benjaminaster.com/css-minecraft/ work (there's no smooth animation when pressing the buttons but I believe that's a separate issue).

Interpolation of the `rotate` property only handled the bare angle
and numeric axis forms. The `x`, `y`, and `z` axis keyword forms fell
back to discrete interpolation. Arguments containing math functions did
the same. Normalize the axis keyword forms to their rotate3d axis
vectors. Resolve calculated angle and axis arguments before
interpolating. The same resolution now applies to rotate3d pairs in
`transform` lists.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Rotation interpolation now accepts an optional animation context. The implementation recognizes rotateZ(), resolves calculated angles and numeric axis components, and shares axis-angle normalization across 2D and 3D rotations. Transform-list and rotate-property callers forward the context. New WPT tests cover rotation composition and sign()/progress() math functions.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the rotate interpolation changes and matches the implementation and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Libraries/LibWeb/Rust/src/css/animation.rs (1)

5138-5144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the transform-list context path.

The new WPT math fixture covers only the individual rotate property. The local test at Line 7085 calls interpolate_rotate_3d without a context and with literal arguments. Add a local Rust test for transform: rotate3d(...) with context-dependent calculated axis and angle values. Also cover rotateZ() normalization. This will detect a lost context argument or an incorrect axis conversion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Libraries/LibWeb/Rust/src/css/animation.rs` around lines 5138 - 5144, Add a
local Rust regression test near the existing interpolate_rotate_3d test that
exercises the transform-list context path with context-dependent calculated axis
and angle values, passing the context through the transform interpolation flow.
Also add coverage verifying rotateZ() normalization, including the expected
converted axis and interpolation result.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Libraries/LibWeb/Rust/src/css/animation.rs`:
- Around line 5138-5144: Add a local Rust regression test near the existing
interpolate_rotate_3d test that exercises the transform-list context path with
context-dependent calculated axis and angle values, passing the context through
the transform interpolation flow. Also add coverage verifying rotateZ()
normalization, including the expected converted axis and interpolation result.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bab1a315-6d2b-4d94-9156-0b1a265cc37e

📥 Commits

Reviewing files that changed from the base of the PR and between 45bdd5e and 2099727.

📒 Files selected for processing (5)
  • Libraries/LibWeb/Rust/src/css/animation.rs
  • Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/animation/rotate-composition.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/animation/rotate-interpolation-math-functions-tentative.txt
  • Tests/LibWeb/Text/input/wpt-import/css/css-transforms/animation/rotate-composition.html
  • Tests/LibWeb/Text/input/wpt-import/css/css-transforms/animation/rotate-interpolation-math-functions-tentative.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant