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.
What niso does
Section titled “What niso does”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 vs actual
Section titled “Expected vs actual”- Expected: a public way to read what
has_active_animationsholds (ElementAnimationSet::needs_animation_ticksover the document’s sets), or anis_animatingvariant withouthas_canvas. - Actual:
has_active_animationsandanimationsarepub(crate),is_animating()ORshas_canvasin, andmay_have_animationsis true for the paused animation.
CARGO_TARGET_DIR=~/.capy/work/repro-target cargo runExit status 1 while the gap exists, 0 once fixed.
Upstream main
Section titled “Upstream main”Not checked against main; tested at the pinned be60597.
Existing issue or PR
Section titled “Existing issue or PR”None searched yet.
Issue text
Section titled “Issue text”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?