Skip to content

blitz-dom: with a `<canvas src>`, nothing public says whether CSS animations need ticks

Generated from repros/blitz-dom-animation-state-hidden-by-canvas/README.md when the site was built at 7aa23e2.

niso’s canvases are 2D contexts, not blitz paint sources, so crates/niso-core/src/event_loop.rs (Dom::animating) cannot use BaseDocument::is_animating() alone: it is true for as long as the document has a <canvas src> (has_canvas). With one, niso falls back to the elements’ public may_have_animations flag. That flag stays set for an animation that is paused, filled forwards, or a transition that finished, because stylo keeps those in the element’s animation set and blitz only clears the flag when the set goes. So a page with a <canvas src> and any such element asks for frames forever, though blitz itself knows none is needed.

  • Expected: a public way to read what has_active_animations holds (ElementAnimationSet::needs_animation_ticks over the document’s sets), or an is_animating variant without has_canvas.
  • Actual: has_active_animations and animations are pub(crate), is_animating() ORs has_canvas in, and may_have_animations is true for the paused animation.
Terminal window
CARGO_TARGET_DIR=~/.capy/work/repro-target cargo run

Exit status 1 while the gap exists, 0 once fixed.

Not checked against main; tested at the pinned be60597.

None searched yet.

Title: Expose whether CSS animations need ticks separately from is_animating()’s has_canvas

Body:

BaseDocument::is_animating() is has_canvas | has_active_animations | ..., and has_active_animations (computed from needs_animation_ticks()) is pub(crate). An embedder whose document has a <canvas src> therefore cannot tell whether its CSS animations and transitions need frames. The public per-element may_have_animations flag does not help: it stays set for paused or forwards-filled animations and for finished transitions, which stylo keeps in the set. Could has_active_animations get a public getter?