Skip to content

Fix transition toggle & cancellation & delay#35978

Merged
Loirooriol merged 1 commit intoservo:mainfrom
yezhizhen:fix-transition
Apr 7, 2025
Merged

Fix transition toggle & cancellation & delay#35978
Loirooriol merged 1 commit intoservo:mainfrom
yezhizhen:fix-transition

Conversation

@yezhizhen
Copy link
Copy Markdown
Member

@yezhizhen yezhizhen commented Mar 14, 2025

More details in Stylo PR: servo/stylo#145


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

Created new test files as well:

  1. css-transitions/transition-remove-and-change-immediate.html
  2. css-transitions/transition-zero-duration-with-delay.html
  3. css-transitions/transitioncancel-003.html

cc @Asun0204 @xiaochengh @stevennovaryo

@yezhizhen yezhizhen changed the title Fix transition toggle & cancel Fix transition toggle & cancellation & delay Mar 15, 2025
@yezhizhen
Copy link
Copy Markdown
Member Author

@yezhizhen
Copy link
Copy Markdown
Member Author

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

Latest successful run. Already applied optimization revamp commit.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#51439) with upstreamable changes.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

2 similar comments
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@sagudev sagudev requested a review from Loirooriol March 19, 2025 09:48
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#51439) title and body.

@yezhizhen
Copy link
Copy Markdown
Member Author

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

I just added tests for all behaviours that was problematic before. CI is passing too.
I don't have further changes in mind right now.

Please review this when you got time :) @Loirooriol

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

Copy link
Copy Markdown
Contributor

@Loirooriol Loirooriol left a comment

Choose a reason for hiding this comment

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

Sorry for the delay reviewing this

Comment on lines +55 to +58
assert_approx_equals(
elapsed, 300, 30, // Allow 30ms tolerance
'Transition should complete after approximately 300ms'
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm concerned that this could be a source of instability. If e.g. the same thread is used to run various tests simultaneously and there are CPU intensive things happening, then I guess the transitionend event could be delivered later.

What's the point of the check, ensuring that the transition doesn't finish immediately? Maybe assert_greater_than would be better?

Copy link
Copy Markdown
Member Author

@yezhizhen yezhizhen Apr 5, 2025

Choose a reason for hiding this comment

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

I checked this to ensure the 0.3s delay is almost accurately executed.
I had this concern before, but later it never seems to happen. But you have the point.

getComputedStyle(div).width;
// Start first transition to 100px
div.style.width = '100px';
// Wait until transition is 25% done (500ms)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why keep waiting until 25%, and not just until transitionrun?

Copy link
Copy Markdown
Member Author

@yezhizhen yezhizhen Apr 5, 2025

Choose a reason for hiding this comment

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

I just felt natural to write like this. But you are right. I've changed it.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

1 similar comment
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@yezhizhen
Copy link
Copy Markdown
Member Author

yezhizhen commented Apr 5, 2025

@Loirooriol @xiaochengh
This seems funny. I changed to assert_greater_than. But now both Firefox and Chrome have very unexpected behaviour beyond my imagination. The transition takes less time less than specified combined duration for chrome/firefox sometimes.

Should I assert_greater_than, but with a tiny tolerance now?

Chrome report: very close but still smaller than expected
Firefox report: much smaller than expected

@Loirooriol
Copy link
Copy Markdown
Contributor

Is the timing check an important part of the test? Would it be fine to drop it?

It seems to fit a bit within the umbrella of https://web-platform-tests.org/writing-tests/testharness-api.html#timers-in-tests

In general the use of timers (i.e. setTimeout) in tests is discouraged because this is an observed source of instability on test running in CI.

@yezhizhen
Copy link
Copy Markdown
Member Author

Ok I will drop it.

@Loirooriol Loirooriol enabled auto-merge April 7, 2025 12:45
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@Loirooriol
Copy link
Copy Markdown
Contributor

It seems DCO check wasn't triggered. I will try a rebase.

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#51439).

@Loirooriol Loirooriol added this pull request to the merge queue Apr 7, 2025
Merged via the queue into servo:main with commit 3242592 Apr 7, 2025
21 checks passed
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

⛔ Failed to properly merge the upstream pull request (web-platform-tests/wpt#51439). Please address any CI issues and try to merge manually.

@yezhizhen yezhizhen deleted the fix-transition branch April 10, 2025 07:53
TG199 pushed a commit to TG199/servo that referenced this pull request Apr 10, 2025
More details in Stylo PR: servo/stylo#145

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes 
- fixes servo#35833
- fixes servo#35982

<!-- Either: -->
- [x] There are new passing test: `css/css-logical/animation-004.html:
Transitions from physical to logical update when the direction is
changed`

Created new test files as well: 

1. `css-transitions/transition-remove-and-change-immediate.html`
2.  `css-transitions/transition-zero-duration-with-delay.html`
3. `css-transitions/transitioncancel-003.html`

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->

cc @Asun0204  @xiaochengh @stevennovaryo

Signed-off-by: Euclid Ye <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2025
….html` (#37179)

Fix the mistake I made in #35978
Testing: No behaviour change.

Signed-off-by: Euclid Ye <[email protected]>
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

5 participants