script: Consolidate step 22 of per-Document rendering update (#37703)

The parts of step 22 were a bit scattered throughout the codebase, so
this
change moves them all to a single method which does three things:

1. Update all animating images
2. Flush all dirty canvases (2D, WebGL, and WebGPU)
3. Calls reflow on the `Document`

Testing: This shouldn't change behavior in any major way so it should
be covered by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-26 08:11:03 +02:00 committed by GitHub
parent 152eb63fb3
commit f745bad37d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 57 deletions

View file

@ -2173,17 +2173,8 @@ impl Window {
let document = self.Document();
let stylesheets_changed = document.flush_stylesheets_for_reflow();
// If this reflow is for display, ensure webgl canvases are composited with
// up-to-date contents.
let for_display = reflow_goal.needs_display();
if for_display {
document.flush_dirty_webgl_canvases();
document.flush_dirty_2d_canvases();
}
let pending_restyles = document.drain_pending_restyles();
let dirty_root = document
.take_dirty_root()
.filter(|_| !stylesheets_changed)