Skip to content

Truly independent web browser

LibWeb: Maintain the layout memos through exclusive access

Aliaksandr Kalenikfb8074c05782
diff --git a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
index c2d9f3baf2b..0db1cac7d06 100644
--- a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
@@ -526,7 +526,8 @@ impl FcRunCacheSlot {
pub(crate) struct FcRunCacheStore {
/// In chunks a fork of the arena shares until either side writes one, so forking does not copy every box's entries.
slots: RefCell<crate::cow_column::CowVec<FcRunCacheSlot, FC_RUN_CACHE_SLOTS_PER_CHUNK>>,
- inline_layout_damage: RefCell<Vec<InlineLayoutDamage>>,
+ /// Noted between passes, and only read during one.
+ inline_layout_damage: Vec<InlineLayoutDamage>,
pending_sweep_slots: RefCell<Vec<u32>>,
enrolled_for_sweep: RefCell<Vec<bool>>,
}
@@ -549,7 +550,7 @@ impl FcRunCacheStore {
})
}
- pub(crate) fn note_invalidated_entry(&self, node: Node) {
+ pub(crate) fn note_invalidated_entry(&mut self, node: Node) {
if self.slot_holds_entries(node.slot_index()) {
self.enqueue_for_sweep(node.slot_index());
}
@@ -592,18 +593,18 @@ impl FcRunCacheStore {
.cloned()
}
- pub(crate) fn remove_entry(&self, slot: u32) {
+ pub(crate) fn remove_entry(&mut self, slot: u32) {
if self.slot_holds_entries(slot) {
- self.slots.borrow_mut()[slot as usize] = FcRunCacheSlot::default();
+ self.slots.get_mut()[slot as usize] = FcRunCacheSlot::default();
}
self.forget_inline_layout_damage(slot);
}
- pub(crate) fn note_inline_layout_damage(&self, box_: Node) {
+ pub(crate) fn note_inline_layout_damage(&mut self, box_: Node) {
if !self.slot_holds_entries(box_.slot_index()) {
return;
}
- let mut damage = self.inline_layout_damage.borrow_mut();
+ let damage = &mut self.inline_layout_damage;
if damage.len() <= box_.slot_index() as usize {
damage.resize(box_.slot_index() as usize + 1, InlineLayoutDamage::default());
}
@@ -622,14 +623,13 @@ impl FcRunCacheStore {
/// from those before its run by the count when it was stored.
fn structural_epoch_bumps_of(&self, box_: Node) -> u32 {
self.inline_layout_damage
- .borrow()
.get(box_.slot_index() as usize)
.filter(|damage| damage.generation == box_.generation())
.map_or(0, |damage| damage.structural_epoch_bumps)
}
- fn forget_inline_layout_damage(&self, slot: u32) {
- if let Some(damage) = self.inline_layout_damage.borrow_mut().get_mut(slot as usize) {
+ fn forget_inline_layout_damage(&mut self, slot: u32) {
+ if let Some(damage) = self.inline_layout_damage.get_mut(slot as usize) {
*damage = InlineLayoutDamage::default();
}
}
@@ -728,14 +728,20 @@ impl FcRunCacheStore {
/// fragments the box did not commit once they went unused for a while, except the latest entry of a box that
/// committed none.
pub(super) fn sweep_pending_entries(
- &self,
+ &mut self,
mut keep: impl FnMut(u32, FcRunCacheValidity) -> bool,
mut is_committed: impl FnMut(Node, &FcRunCacheEntry) -> bool,
layout_commit_count: u64,
) {
- let mut slots = self.slots.borrow_mut();
- let mut enrolled = self.enrolled_for_sweep.borrow_mut();
- let mut pending_sweep_slots = self.pending_sweep_slots.borrow_mut();
+ let Self {
+ slots,
+ inline_layout_damage,
+ pending_sweep_slots,
+ enrolled_for_sweep: enrolled,
+ } = self;
+ let slots = slots.get_mut();
+ let enrolled = enrolled.get_mut();
+ let pending_sweep_slots = pending_sweep_slots.get_mut();
let mut slots_holding_entries_that_may_go_unused = Vec::new();
for slot in pending_sweep_slots.drain(..) {
enrolled[slot as usize] = false;
@@ -776,8 +782,11 @@ impl FcRunCacheStore {
}
entries.earlier = earlier;
entries.refresh_summaries();
- if entries.latest.is_none() && entries.committed.is_none() {
- self.forget_inline_layout_damage(slot);
+ if entries.latest.is_none()
+ && entries.committed.is_none()
+ && let Some(damage) = inline_layout_damage.get_mut(slot as usize)
+ {
+ *damage = InlineLayoutDamage::default();
}
}
for slot in slots_holding_entries_that_may_go_unused {
@@ -1142,7 +1151,7 @@ mod tests {
#[test]
fn sweep_checks_changed_entries_without_discarding_reusable_stale_data_early() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let entry = |epoch| entry(at(300), epoch, None, 0);
store.store(Node::new(0, 1), entry(1), nothing_is_committed);
store.store(Node::new(1, 1), entry(1), nothing_is_committed);
@@ -1179,7 +1188,7 @@ mod tests {
#[test]
fn a_store_keeps_the_entry_whose_fragments_the_box_committed_beside_newer_ones() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1210,7 +1219,7 @@ mod tests {
#[test]
fn the_sweep_keeps_the_entry_whose_fragments_the_box_committed_and_its_fragments() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1252,7 +1261,7 @@ mod tests {
#[test]
fn an_earlier_entry_committed_in_place_of_the_latest_one_stays_beside_later_stores() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1288,7 +1297,7 @@ mod tests {
#[test]
fn a_committed_entry_that_no_longer_describes_the_committed_subtree_goes() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1308,7 +1317,7 @@ mod tests {
#[test]
fn entries_holding_fragments_the_box_never_committed_go_after_two_unused_layout_commits_beside_one_it_did() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1346,7 +1355,7 @@ mod tests {
#[test]
fn the_latest_entry_of_a_box_that_committed_none_of_its_entries_stays() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
@@ -1400,20 +1409,20 @@ mod tests {
fn queued_memo_invalidations_count_structural_changes_only_while_the_box_holds_entries() {
use crate::layout::in_flow_block_cache::InFlowBlockCacheStore;
use crate::layout::memo_invalidations::MemoInvalidations;
- let store = FcRunCacheStore::default();
- let in_flow_block_cache = InFlowBlockCacheStore::default();
- let text_memos = crate::layout::rendered_text::TextMemos::default();
- let prepared_inline_content = crate::layout::prepared_inline_content::PreparedInlineContentMemos::default();
- let intrinsic_size_caches = crate::layout::layout_node_arena::IntrinsicSizeCaches::default();
+ let mut store = FcRunCacheStore::default();
+ let mut in_flow_block_cache = InFlowBlockCacheStore::default();
+ let mut text_memos = crate::layout::rendered_text::TextMemos::default();
+ let mut prepared_inline_content = crate::layout::prepared_inline_content::PreparedInlineContentMemos::default();
+ let mut intrinsic_size_caches = crate::layout::layout_node_arena::IntrinsicSizeCaches::default();
let node = Node::new(0, 1);
let mut notes = MemoInvalidations::default();
notes.note_structural_inline_change(node);
notes.apply_to(
- &store,
- &in_flow_block_cache,
- &text_memos,
- &prepared_inline_content,
- &intrinsic_size_caches,
+ &mut store,
+ &mut in_flow_block_cache,
+ &mut text_memos,
+ &mut prepared_inline_content,
+ &mut intrinsic_size_caches,
);
assert_eq!(store.structural_epoch_bumps_of(node), 0);
@@ -1427,11 +1436,11 @@ mod tests {
notes.note_fragment_cache_epoch_bumped(node);
notes.note_structural_inline_change(node);
notes.apply_to(
- &store,
- &in_flow_block_cache,
- &text_memos,
- &prepared_inline_content,
- &intrinsic_size_caches,
+ &mut store,
+ &mut in_flow_block_cache,
+ &mut text_memos,
+ &mut prepared_inline_content,
+ &mut intrinsic_size_caches,
);
assert_eq!(store.structural_epoch_bumps_of(node), 2);
@@ -1441,11 +1450,11 @@ mod tests {
notes.note_slot_freed(node.slot_index());
notes.note_structural_inline_change(reused);
notes.apply_to(
- &store,
- &in_flow_block_cache,
- &text_memos,
- &prepared_inline_content,
- &intrinsic_size_caches,
+ &mut store,
+ &mut in_flow_block_cache,
+ &mut text_memos,
+ &mut prepared_inline_content,
+ &mut intrinsic_size_caches,
);
assert!(!store.slot_holds_entries(0));
assert_eq!(store.structural_epoch_bumps_of(reused), 0);
@@ -1453,7 +1462,7 @@ mod tests {
#[test]
fn a_store_keeps_the_inline_damage_an_earlier_entry_saw() {
- let store = FcRunCacheStore::default();
+ let mut store = FcRunCacheStore::default();
let box_ = Node::new(0, 1);
store.store(
box_,
diff --git a/Libraries/LibWeb/Rust/src/layout/host_tables.rs b/Libraries/LibWeb/Rust/src/layout/host_tables.rs
index 5678a171c62..02ac80cd7a9 100644
--- a/Libraries/LibWeb/Rust/src/layout/host_tables.rs
+++ b/Libraries/LibWeb/Rust/src/layout/host_tables.rs
@@ -178,9 +178,11 @@ impl ArenaHandle {
&mut self.arena
}
- /// The arena to write, beside the layout stage's scratch, which the stage reads as it prepares and ends a pass.
- pub(crate) fn arena_mut_and_layout_scratch(&mut self) -> (&mut LayoutNodeArena, &super::run_state::LayoutScratch) {
- (&mut self.arena, &self.layout_scratch)
+ /// The arena to write, beside the layout stage's scratch, which the stage maintains as it prepares and ends a pass.
+ pub(crate) fn arena_mut_and_layout_scratch(
+ &mut self,
+ ) -> (&mut LayoutNodeArena, &mut super::run_state::LayoutScratch) {
+ (&mut self.arena, &mut self.layout_scratch)
}
}
diff --git a/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs b/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
index 6fbfd318bcb..a79c5e88899 100644
--- a/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
+++ b/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
@@ -140,8 +140,8 @@ impl InFlowBlockCacheStore {
slot.latest = Some(std::sync::Arc::new(entry));
}
- pub(crate) fn remove_entry(&self, slot: u32) {
- let mut entries = self.entries.borrow_mut();
+ pub(crate) fn remove_entry(&mut self, slot: u32) {
+ let entries = self.entries.get_mut();
if entries
.get(slot as usize)
.is_some_and(|entries| entries.latest.is_some() || entries.committed.is_some())
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index f7c39d140de..2ffabd569e3 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -259,8 +259,8 @@ pub(crate) struct IntrinsicSizeCaches {
}
impl IntrinsicSizeCaches {
- pub(crate) fn drop_entries_of_slot(&self, slot: u32) {
- if let Some(slot) = self.slots.borrow_mut().get_mut(slot as usize) {
+ pub(crate) fn drop_entries_of_slot(&mut self, slot: u32) {
+ if let Some(slot) = self.slots.get_mut().get_mut(slot as usize) {
*slot = IntrinsicSizeCacheSlot::default();
}
}
@@ -1388,7 +1388,7 @@ impl LayoutNodeArena {
/// committed and ages the others. Checks only boxes whose entries were invalidated, stored or used since the
/// previous sweep, or can still age out. Stale entries survive until commit so inline layout can reuse their
/// undamaged line prefixes.
- pub(crate) fn sweep_stale_fc_run_cache_entries(&self, store: &super::fc_run_cache::FcRunCacheStore) {
+ pub(crate) fn sweep_stale_fc_run_cache_entries(&self, store: &mut super::fc_run_cache::FcRunCacheStore) {
store.sweep_pending_entries(
|slot, validity| {
let Some(metadata) = self.slot_metadata.get(slot as usize) else {
@@ -7542,8 +7542,7 @@ mod tests {
#[test]
fn intrinsic_size_cache_entries_go_with_noted_resets_and_slot_reuse() {
let mut arena = LayoutNodeArena::new();
- let scratch = crate::layout::run_state::LayoutScratch::default();
- let caches = &scratch.intrinsic_size_caches;
+ let mut scratch = crate::layout::run_state::LayoutScratch::default();
let first = arena.allocate_for_test();
scratch.apply_memo_invalidations(&mut arena);
let key = IntrinsicSizeCacheKey {
@@ -7563,28 +7562,50 @@ mod tests {
depends_on_percentage_inline_basis: false,
depends_on_block_size: false,
};
- caches.max_content_block_size_cache_put(first.slot, key, value);
- caches.intrinsic_inline_size_measurement_cache_put(first.slot, key, inline_measurement);
- assert_eq!(caches.max_content_block_size_cache_get(first.slot, key), Some(value));
+ scratch
+ .intrinsic_size_caches
+ .max_content_block_size_cache_put(first.slot, key, value);
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_put(first.slot, key, inline_measurement);
assert_eq!(
- caches.intrinsic_inline_size_measurement_cache_get(first.slot, key),
+ scratch
+ .intrinsic_size_caches
+ .max_content_block_size_cache_get(first.slot, key),
+ Some(value)
+ );
+ assert_eq!(
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_get(first.slot, key),
Some(inline_measurement)
);
arena.reset_cached_intrinsic_sizes(first.slot);
assert_eq!(
- caches.intrinsic_inline_size_measurement_cache_get(first.slot, key),
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_get(first.slot, key),
Some(inline_measurement),
"a reset reaches the cache when the stage applies the arena's notes"
);
scratch.apply_memo_invalidations(&mut arena);
- assert_eq!(caches.max_content_block_size_cache_get(first.slot, key), None);
assert_eq!(
- caches.intrinsic_inline_size_measurement_cache_get(first.slot, key),
+ scratch
+ .intrinsic_size_caches
+ .max_content_block_size_cache_get(first.slot, key),
+ None
+ );
+ assert_eq!(
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_get(first.slot, key),
None
);
- caches.intrinsic_inline_size_measurement_cache_put(first.slot, key, inline_measurement);
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_put(first.slot, key, inline_measurement);
arena
.free_subtree(first.slot)
.destroy_shells_and_invoke_callbacks(&crate::stage::MainThread::for_test());
@@ -7592,13 +7613,17 @@ mod tests {
assert_eq!(second.slot.slot_index(), first.slot.slot_index());
assert_ne!(second.slot, first.slot);
assert_eq!(
- caches.intrinsic_inline_size_measurement_cache_get(second.slot, key),
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_get(second.slot, key),
None,
"a reused slot misses by its generation before the stage applies the freeing note"
);
scratch.apply_memo_invalidations(&mut arena);
assert_eq!(
- caches.intrinsic_inline_size_measurement_cache_get(second.slot, key),
+ scratch
+ .intrinsic_size_caches
+ .intrinsic_inline_size_measurement_cache_get(second.slot, key),
None
);
arena
diff --git a/Libraries/LibWeb/Rust/src/layout/memo_invalidations.rs b/Libraries/LibWeb/Rust/src/layout/memo_invalidations.rs
index 9ae3de011cd..17aa4ef5a7b 100644
--- a/Libraries/LibWeb/Rust/src/layout/memo_invalidations.rs
+++ b/Libraries/LibWeb/Rust/src/layout/memo_invalidations.rs
@@ -106,11 +106,11 @@ impl MemoInvalidations {
/// Applies the notes to the memos, in the order the boxes were first noted.
pub(crate) fn apply_to(
self,
- run_cache: &FcRunCacheStore,
- in_flow_block_cache: &InFlowBlockCacheStore,
- text_memos: &TextMemos,
- prepared_inline_content: &PreparedInlineContentMemos,
- intrinsic_size_caches: &IntrinsicSizeCaches,
+ run_cache: &mut FcRunCacheStore,
+ in_flow_block_cache: &mut InFlowBlockCacheStore,
+ text_memos: &mut TextMemos,
+ prepared_inline_content: &mut PreparedInlineContentMemos,
+ intrinsic_size_caches: &mut IntrinsicSizeCaches,
) {
for slot in self.noted_slots {
let notes = self.slots[slot as usize];
diff --git a/Libraries/LibWeb/Rust/src/layout/partial_relayout.rs b/Libraries/LibWeb/Rust/src/layout/partial_relayout.rs
index 973791eb4ee..c0a2071a8cc 100644
--- a/Libraries/LibWeb/Rust/src/layout/partial_relayout.rs
+++ b/Libraries/LibWeb/Rust/src/layout/partial_relayout.rs
@@ -960,7 +960,7 @@ mod tests {
#[test]
fn marking_a_node_marks_clean_ancestors_and_drops_their_intrinsic_sizes() {
let mut arena = LayoutNodeArena::new();
- let scratch = LayoutScratch::default();
+ let mut scratch = LayoutScratch::default();
let parent = allocate_box_with_a_dummy_shell(&mut arena);
let child = allocate_box_with_a_dummy_shell(&mut arena);
arena.insert_child(parent.slot, child.slot, NodeSlotId::INVALID);
@@ -997,7 +997,7 @@ mod tests {
#[test]
fn remarking_a_dirty_non_boundary_node_leaves_its_parent_clean_and_drops_their_intrinsic_sizes() {
let mut arena = LayoutNodeArena::new();
- let scratch = LayoutScratch::default();
+ let mut scratch = LayoutScratch::default();
let parent = allocate_box_with_a_dummy_shell(&mut arena);
let child = allocate_box_with_a_dummy_shell(&mut arena);
arena.insert_child(parent.slot, child.slot, NodeSlotId::INVALID);
diff --git a/Libraries/LibWeb/Rust/src/layout/prepared_inline_content.rs b/Libraries/LibWeb/Rust/src/layout/prepared_inline_content.rs
index a0499da51a0..b9a0d66c853 100644
--- a/Libraries/LibWeb/Rust/src/layout/prepared_inline_content.rs
+++ b/Libraries/LibWeb/Rust/src/layout/prepared_inline_content.rs
@@ -272,8 +272,8 @@ impl PreparedInlineContentMemos {
by_slot[index] = Some(prepared);
}
- pub(crate) fn forget(&self, slot: u32) {
- if let Some(kept) = self.by_slot.borrow_mut().get_mut(slot as usize) {
+ pub(crate) fn forget(&mut self, slot: u32) {
+ if let Some(kept) = self.by_slot.get_mut().get_mut(slot as usize) {
*kept = None;
}
}
diff --git a/Libraries/LibWeb/Rust/src/layout/rendered_text.rs b/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
index 06bd19155e4..c6a9d1678b2 100644
--- a/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
+++ b/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
@@ -318,12 +318,12 @@ impl TextMemos {
}
/// Lets go of what the memos keep for the row in `slot`, which the arena freed.
- pub(crate) fn forget(&self, slot: u32) {
- let mut chunks = self.chunks.borrow_mut();
+ pub(crate) fn forget(&mut self, slot: u32) {
+ let chunks = self.chunks.get_mut();
if chunks.get(slot as usize).is_some_and(Option::is_some) {
chunks[slot as usize] = None;
}
- if let Some(segmenter) = self.grapheme_segmenters.borrow_mut().get_mut(slot as usize) {
+ if let Some(segmenter) = self.grapheme_segmenters.get_mut().get_mut(slot as usize) {
*segmenter = None;
}
}
@@ -561,11 +561,14 @@ mod tests {
use std::sync::Arc;
let mut arena = LayoutNodeArena::new();
- let scratch = crate::layout::run_state::LayoutScratch::default();
+ let mut scratch = crate::layout::run_state::LayoutScratch::default();
let node = arena.allocate_for_test().slot;
arena.set_text_content(node, content("hello", 0, 5, Vec::new()));
scratch.apply_memo_invalidations(&mut arena);
- let text_chunks = |arena: &LayoutNodeArena, key: &TextChunkCacheKey, compute: &dyn Fn() -> Vec<TextChunk>| {
+ let text_chunks = |scratch: &crate::layout::run_state::LayoutScratch,
+ arena: &LayoutNodeArena,
+ key: &TextChunkCacheKey,
+ compute: &dyn Fn() -> Vec<TextChunk>| {
scratch
.text_memos()
.text_chunks(node, arena.text_content(node).unwrap().rendered(), key, compute)
@@ -593,12 +596,13 @@ mod tests {
can_break_after: true,
text_type: 0,
};
- let original = text_chunks(&arena, &key, &|| vec![chunk.clone()]);
- let hit = text_chunks(&arena, &key, &|| panic!("matching chunks should be cached"));
+ let original = text_chunks(&scratch, &arena, &key, &|| vec![chunk.clone()]);
+ let hit = text_chunks(&scratch, &arena, &key, &|| panic!("matching chunks should be cached"));
assert!(Arc::ptr_eq(&original, &hit));
drop(hit);
let original_weak = Arc::downgrade(&original);
let replacement = text_chunks(
+ &scratch,
&arena,
&TextChunkCacheKey {
should_wrap_lines: false,
@@ -643,7 +647,7 @@ mod tests {
published_text(&arena.publish_paint_facts().text).text,
"goodbye".encode_utf16().collect::<Vec<_>>()
);
- let new_chunks = text_chunks(&arena, &key, &|| vec![chunk.clone()]);
+ let new_chunks = text_chunks(&scratch, &arena, &key, &|| vec![chunk.clone()]);
assert_eq!(&**new_chunks, std::slice::from_ref(&chunk));
drop(replacement);
assert!(replacement_weak.upgrade().is_none());
@@ -661,7 +665,7 @@ mod tests {
use std::sync::Arc;
let mut arena = LayoutNodeArena::new();
- let scratch = LayoutScratch::default();
+ let mut scratch = LayoutScratch::default();
let block = arena.allocate_for_test().slot;
scratch.apply_memo_invalidations(&mut arena);
let keep = |arena: &LayoutNodeArena, scratch: &LayoutScratch| {
diff --git a/Libraries/LibWeb/Rust/src/layout/run_state.rs b/Libraries/LibWeb/Rust/src/layout/run_state.rs
index 239f251a5e3..693efcbfa2e 100644
--- a/Libraries/LibWeb/Rust/src/layout/run_state.rs
+++ b/Libraries/LibWeb/Rust/src/layout/run_state.rs
@@ -130,20 +130,20 @@ impl LayoutScratch {
}
/// Brings the run memos up to date with what the arena's writes since the last call did to their boxes.
- pub(super) fn apply_memo_invalidations(&self, arena: &mut LayoutNodeArena) {
+ pub(super) fn apply_memo_invalidations(&mut self, arena: &mut LayoutNodeArena) {
arena.take_memo_invalidations().apply_to(
- &self.fc_run_cache_store,
- &self.in_flow_block_cache_store,
- &self.text_memos,
- &self.prepared_inline_content_memos,
- &self.intrinsic_size_caches,
+ &mut self.fc_run_cache_store,
+ &mut self.in_flow_block_cache_store,
+ &mut self.text_memos,
+ &mut self.prepared_inline_content_memos,
+ &mut self.intrinsic_size_caches,
);
}
/// Brings the run memos up to date with what the commit into `arena` did to their boxes, and sweeps the run cache.
- pub(crate) fn end_layout_pass(&self, arena: &mut LayoutNodeArena) {
+ pub(crate) fn end_layout_pass(&mut self, arena: &mut LayoutNodeArena) {
self.apply_memo_invalidations(arena);
- arena.sweep_stale_fc_run_cache_entries(&self.fc_run_cache_store);
+ arena.sweep_stale_fc_run_cache_entries(&mut self.fc_run_cache_store);
}
}