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

Have animations more closely match the HTML spec #26407

Merged
merged 2 commits into from May 6, 2020

Conversation

@mrobinson
Copy link
Member

mrobinson commented May 4, 2020

These two commits do two major things:

Have animations ticks trigger a restyle: This corrects synchronization issues with animations,
where the values used in layout are out of sync with what is returned by getComputedStyle.

Tick the animation timer in script according to spec: This greatly reduces the flakiness of
animation and transitions tests.

Fixes #13865.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #13865
  • There are tests for these changes
@highfive
Copy link

highfive commented May 4, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/window.rs, components/script/dom/testbinding.rs, components/script/dom/webidls/TestBinding.webidl, components/script/script_thread.rs, components/script/dom/node.rs and 1 more
  • @cbrewster: components/constellation/constellation.rs
  • @KiChjang: components/script/dom/window.rs, components/script_traits/lib.rs, components/script/dom/testbinding.rs, components/script/dom/webidls/TestBinding.webidl, components/script/script_thread.rs and 2 more
  • @emilio: components/layout/animation.rs, components/style/matching.rs, components/style/animation.rs, components/style/context.rs
@highfive
Copy link

highfive commented May 4, 2020

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@mrobinson
Copy link
Member Author

mrobinson commented May 4, 2020

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented May 4, 2020

Trying commit 04d8e27 with merge 101c6e7...

bors-servo added a commit that referenced this pull request May 4, 2020
[RFC] Use a restyle for animation ticks

This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #13865

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented May 4, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented May 4, 2020

Should this PR enable the disabled tests, or are there other prerequisites?

@mrobinson
Copy link
Member Author

mrobinson commented May 4, 2020

@jdm, yep. Currently, I think there are only two disabled:

  • mozilla/css/animations/basic-transition.html
  • mozilla/css/animations/transition-raf.html

These are enabled by removing the ini files which were disabling them. Could it be that there are more disabled in another directory?

@mrobinson mrobinson force-pushed the mrobinson:animation-restyle-model branch from 04d8e27 to 8131ee3 May 4, 2020
@highfive highfive removed the S-tests-failed label May 4, 2020
@mrobinson
Copy link
Member Author

mrobinson commented May 4, 2020

@bors-servo try=wpt

Removing two expectations for newly passing tests.

@bors-servo
Copy link
Contributor

bors-servo commented May 4, 2020

Trying commit 8131ee3 with merge 5875d05...

bors-servo added a commit that referenced this pull request May 4, 2020
[RFC] Use a restyle for animation ticks

This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #13865

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- 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. -->
@jdm
Copy link
Member

jdm commented May 4, 2020

What about the animation-related test directories skipped in include.ini?

@bors-servo
Copy link
Contributor

bors-servo commented May 4, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@mrobinson
Copy link
Member Author

mrobinson commented May 4, 2020

I wasn't sure if it was better to unskip intermittent tests later, but I'm happy to give it a shot in this change.

@mrobinson
Copy link
Member Author

mrobinson commented May 4, 2020

It looks like there is more required to eliminate the flakiness from animations and transitions tests. My suspicion is that this is #19242 and perhaps, in addition, making sure that transition and animation events arrive to the script thread before the next animation tick is triggered. I'll start taking a look at this tomorrow. It seems like it would be good to have this all sorted out before going too much further.

@jdm
jdm approved these changes May 4, 2020
const CLICK_IN_PROGRESS = 1 << 2;
const CLICK_IN_PROGRESS = 1 << 3;

#[doc = "Specifies whether this node is focusable and whether it is supposed \
to be reachable with using sequential focus navigation."]
const SEQUENTIALLY_FOCUSABLE = 1 << 3;
const SEQUENTIALLY_FOCUSABLE = 1 << 4;

// There are two free bits here.
// There is one bit free here.
Comment on lines 173 to 179

This comment has been minimized.

@jdm

jdm May 4, 2020

Member

Why these changes?

This comment has been minimized.

@mrobinson

mrobinson May 4, 2020

Author Member

Whoops. This is left over from a previous version of this change where I added NodeFlags::HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS. It turns out that isn't necessary for this change, so I'll remove these changes as well.

@mrobinson mrobinson changed the title [RFC] Use a restyle for animation ticks [RFC] Have animations more closely match the HTML spec May 5, 2020
@mrobinson mrobinson force-pushed the mrobinson:animation-restyle-model branch from 8131ee3 to 84b5f97 May 5, 2020
This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.
@mrobinson mrobinson force-pushed the mrobinson:animation-restyle-model branch from 84b5f97 to 7ff8900 May 5, 2020
@mrobinson
Copy link
Member Author

mrobinson commented May 5, 2020

@bors-servo try=wpt

This is a small step toward fixing #19242. The main idea is that the
clock for animations should advance as the event loop ticks. We
accomplish this by moving the clock from layout and naming it the
"animation timeline" which is the spec language. This should fix
flakiness with animations and transitions tests where a reflow could
move animations forward while script was running.

This change also starts to break out transition and animation events
into their own data structure, because it's quite likely that the next
step in fixing #19242 is to no longer send these events through a
channel.
@mrobinson mrobinson force-pushed the mrobinson:animation-restyle-model branch from 3f3171e to 3a74013 May 5, 2020
@highfive highfive removed the S-tests-failed label May 5, 2020
@mrobinson
Copy link
Member Author

mrobinson commented May 5, 2020

@bors-servo try=wpt

bors-servo added a commit that referenced this pull request May 5, 2020
[RFC] Have animations more closely match the HTML spec

These two commits do two major things:

**Have animations ticks trigger a restyle**: This corrects synchronization issues with animations,
where the values used in layout are out of sync with what is returned by `getComputedStyle`.

**Tick the animation timer in script according to spec**: This greatly reduces the flakiness of
animation and transitions tests.

Fixes #13865.

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #13865

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

Trying commit 3a74013 with merge 47ba832...

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@mrobinson
Copy link
Member Author

mrobinson commented May 5, 2020

@bors-servo try=wpt-mac

@jdm
Copy link
Member

jdm commented May 5, 2020

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

Trying commit 3a74013 with merge 473e368...

bors-servo added a commit that referenced this pull request May 5, 2020
[RFC] Have animations more closely match the HTML spec

These two commits do two major things:

**Have animations ticks trigger a restyle**: This corrects synchronization issues with animations,
where the values used in layout are out of sync with what is returned by `getComputedStyle`.

**Tick the animation timer in script according to spec**: This greatly reduces the flakiness of
animation and transitions tests.

Fixes #13865.

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #13865

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@jdm
jdm approved these changes May 5, 2020
@mrobinson mrobinson changed the title [RFC] Have animations more closely match the HTML spec Have animations more closely match the HTML spec May 6, 2020
@mrobinson
Copy link
Member Author

mrobinson commented May 6, 2020

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2020

📌 Commit 3a74013 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2020

Testing commit 3a74013 with merge b290ad9...

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing b290ad9 to master...

@bors-servo bors-servo merged commit b290ad9 into servo:master May 6, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
@atouchet atouchet mentioned this pull request May 6, 2020
4 of 13 tasks complete
@mrobinson mrobinson deleted the mrobinson:animation-restyle-model branch May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.