Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken transition toggle, cancellation, and delay #145

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yezhizhen
Copy link
Contributor

@yezhizhen yezhizhen commented Mar 14, 2025

  1. Remove unnecessary "mut" specifier for clarity
  2. Implement more all CSS transition steps according to spec. Able to cancel more all running transitions as expected, with same test case in the first linked issue
  3. This PR

Following debug message was triggered by following the action in the first issue.

[2025-03-07T07:18:44Z WARN  style::properties::cascade] apply_prioritary_properties decl: transform: translateY(100px) translateZ(0px), priority: CascadePriority { cascade_level: Transitions, layer_order: LayerOrder(65534) }
[2025-03-07T07:18:44Z WARN  style::properties::cascade] apply_prioritary_properties decl: transform: translateY(0px) translateZ(0px), priority: CascadePriority { cascade_level: AuthorNormal { shadow_cascade_order: ShadowCascadeOrder(0) }, layer_order: LayerOrder(65535) }

It was because the transform: translate in after-change style get over-shadowed by already finished transition style, which has highest cascade priority: Transitions.

New passing test:
css/css-logical/animation-004.html: Transitions from physical to logical update when the direction is changed

Added new test:
css-transitions/transition-remove-and-transform-immediate.html

Servo PR: servo/servo#35978
cc @stevennovaryo @xiaochengh @Asun0204

Copy link
Collaborator

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

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

This needs to be rebased on top of the latest main

@yezhizhen yezhizhen force-pushed the fix-transition-order branch from 230370b to ed063e7 Compare March 14, 2025 07:55
@yezhizhen yezhizhen changed the title Fix transition order Fix broken transition toggle Mar 14, 2025
@yezhizhen yezhizhen marked this pull request as ready for review March 14, 2025 11:11
@yezhizhen yezhizhen requested a review from nicoburns March 14, 2025 11:11
@yezhizhen yezhizhen changed the title Fix broken transition toggle Fix broken transition toggle and cancelling Mar 14, 2025
@yezhizhen yezhizhen force-pushed the fix-transition-order branch 2 times, most recently from 7f43b7b to 090b1fe Compare March 14, 2025 16:37
@yezhizhen
Copy link
Contributor Author

yezhizhen commented Mar 14, 2025

@yezhizhen yezhizhen changed the title Fix broken transition toggle and cancelling Fix broken transition toggle, cancellation, and delay Mar 15, 2025
@yezhizhen yezhizhen force-pushed the fix-transition-order branch 2 times, most recently from 80fa179 to 560638c Compare March 16, 2025 07:28
@yezhizhen
Copy link
Contributor Author

What should I rebase on now? I got many conflicts when rebasing on main.

@Loirooriol
Copy link
Contributor

I force-pushed the main branch to sync changes from upstream, which is not ideal for PRs.

With your branch at 08279e1, you should be able to do

git rebase --onto main 7ee9643e7ff1633c709f4ffd683050eb3c726ec9 fix-transition-order

Where 7ee9643 is the nearest common ancestor of your branch and https://github.com/servo/stylo/commits/2025-03-11/

@yezhizhen yezhizhen force-pushed the fix-transition-order branch 2 times, most recently from 172dac0 to 28fc84e Compare March 17, 2025 10:35
@yezhizhen
Copy link
Contributor Author

yezhizhen commented Mar 17, 2025

Somehow I cannot compile anymore.. I just fetched the latest Servo main branch.

I am on the latest Servo main branch.
Latest Stylo branch, with my five commits.
But I get a lot of

error[E0053]: method `report_error` has an incompatible type for trait
   --> components\script\dom\fontface.rs:180:20
    |
180 |         _location: cssparser::SourceLocation,
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `style::values::SourceLocation`, found `cssparser::SourceLocation`

@nicoburns
Copy link
Collaborator

Somehow I cannot compile anymore.. I just fetched the latest Servo main branch.
I am on the latest Servo main branch. Latest Stylo branch, with my five commits.

@yezhizhen You upgraded to the latest Stylo branch a little too quickly! CI is still running on the corresponding Servo PR (servo/servo#35990). Your code should compile again once that merges. Until then you can run against the 2025-03-12 Stylo branch.

@yezhizhen
Copy link
Contributor Author

Haha thanks Nico! I will get back tomorrow then :)

2. Implement step 4.1, 4.2 of CSS transition
3. Remove unnecessary `mut` for readability

Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
@yezhizhen yezhizhen force-pushed the fix-transition-order branch 2 times, most recently from 4a2dd8c to 4ef8b50 Compare March 17, 2025 14:55
@yezhizhen
Copy link
Contributor Author

yezhizhen commented Mar 17, 2025

I still cannot compile locally, with latest pulled repo
I think there is something wrong with current Cargo.toml in Servo for using local stylo.

I made some adjustments to Cargo.toml in Servo. It starts to compile, but has following errors now:

error[E0277]: the trait bound `ElementState: MallocSizeOf` is not satisfied
   --> D:\Rust\Cargo\git\checkouts\stylo-482338307e42a9ea\6aa5733\style\servo\selector_parser.rs:778:26
    |
778 | #[derive(Debug, Default, MallocSizeOf)]
    |                          ^^^^^^^^^^^^ the trait `MallocSizeOf` is not implemented for `ElementState`

EDIT: Seems to work now after servo/servo#36011

@yezhizhen yezhizhen requested a review from Loirooriol March 18, 2025 02:57
@yezhizhen
Copy link
Contributor Author

yezhizhen commented Mar 18, 2025

https://github.com/yezhizhen/servo/actions/runs/13914368346/job/38936024866

Regression: Failing WPT test after optimization "Revamp".. Fixing it..

EDIT: Fixed

@yezhizhen yezhizhen force-pushed the fix-transition-order branch 3 times, most recently from 0cf369f to 5aae785 Compare March 18, 2025 07:54
@yezhizhen

This comment was marked as outdated.

@yezhizhen
Copy link
Contributor Author

yezhizhen commented Mar 18, 2025

Passing locally already.

./mach test-wpt _mozilla/css/transitionend_event.html _mozilla/css/transition_calc_implicit.html

Running WPT tests with D:\servo\target\debug\servo.exe
Running 2 tests in web-platform-tests

Ran 2 tests finished in 5.8 seconds.
  • 2 ran as expected.

Running Git actions now.

https://github.com/yezhizhen/servo/actions/runs/13919914249

EDIT: Passed

@yezhizhen
Copy link
Contributor Author

I just added a new wpt-test in servo/servo#35978, which Servo was failing before this PR.

But the Servo PR has no reviewers yet.

Signed-off-by: Euclid Ye <[email protected]>
@yezhizhen yezhizhen force-pushed the fix-transition-order branch from d59fdb6 to eebf6af Compare March 19, 2025 05:44
Signed-off-by: Euclid Ye <[email protected]>
@yezhizhen yezhizhen force-pushed the fix-transition-order branch from eebf6af to 91220ab Compare March 19, 2025 06:34
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.

No delay when transition duration is 0 transition switch to initial value is failed
4 participants