Skip to content

Truly independent web browser

LibWeb: Free style records on the fork of a clock lane

Andreas Kling63c6e11e75ea
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication.rs b/Libraries/LibWeb/Rust/src/css/style/publication.rs
index ebe91d3afea..4c2c6ac9a2b 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication.rs
@@ -693,6 +693,12 @@ impl StyleEngine {
self.reclaim_unreachable_computed_records();
}
+ /// Frees the records the samples of a clock tick let go of, as a style update does: a fork of the render state sees
+ /// no style update for as long as a task keeps the host from one.
+ pub(crate) fn free_style_records_after_tick(&mut self) {
+ self.reclaim_unreachable_computed_records();
+ }
+
/// Frees the installed records nothing holds, where nothing views them, and once enough were freed reclaims the
/// custom-property environments no record names any more. Answers whether it reclaimed them.
pub(super) fn reclaim_unreachable_computed_records(&mut self) -> bool {
diff --git a/Libraries/LibWeb/Rust/src/render_state/clock.rs b/Libraries/LibWeb/Rust/src/render_state/clock.rs
index 612baa32dc8..cc7ab5bc7aa 100644
--- a/Libraries/LibWeb/Rust/src/render_state/clock.rs
+++ b/Libraries/LibWeb/Rust/src/render_state/clock.rs
@@ -1411,6 +1411,7 @@ impl Lane {
}
};
let ticked = self.tick(&mut fork, frame_time_nanoseconds, pointer, samples_animations);
+ fork.engine_mut().free_style_records_after_tick();
self.state = LaneState::Forked { fork, state_moved_on };
Some(ticked)
}