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

Animations for nodes that are not visible are never removed from the list of running animations #22378

Closed
jdm opened this issue Dec 6, 2018 · 3 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Dec 6, 2018

<style>
@keyframes boo {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
#box { animation: boo 1s infinite; }
</style>
<div id="box">hi there!</div>
<script>setTimeout(function() { document.getElementById('box').remove(); }, 3000)</script>

If you look at the list of layout events, the animation continues triggering after the node is removed from the document.

@jdm
Copy link
Member Author

@jdm jdm commented Dec 6, 2018

When updating animations as part of regular layout, we should be able to check if there is a fragment associated with the animation's node. If there is not, it is either outside the document or display: none, so we could expire the animation.

@jdm
Copy link
Member Author

@jdm jdm commented Dec 6, 2018

We should have a testcase for changing the element's style display to none, as well.

@jdm
Copy link
Member Author

@jdm jdm commented Dec 6, 2018

This can happen in recalc_style_for_animations by tracking which animations in animations were actually updated and removing them from the hashmap otherwise.

bors-servo added a commit that referenced this issue Dec 8, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 8, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 8, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 10, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 10, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 10, 2018
Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22389)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.