From 2d001e2c855caeaaa19a78ee01c9cd76d13ab476 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Wed, 9 Apr 2025 15:32:07 +0200 Subject: layout: Enable using cached fragments when there is a BoxTree update point (#36404) This starts to enable the fragment cache for all layout modes, except grid. The main tricky bit here is that update points are absolutes and these need to be laid out again in their containing blocks. We punt a little bit on this, by forcing ancestors of update points to rebuild their Fragments. This is just the first step. Testing: We do not currently have layout performance tests, but will try to run some tests manually later. Behavior is covered by the WPT. Co-authored-by: Oriol Brufau Signed-off-by: Martin Robinson Signed-off-by: Martin Robinson Co-authored-by: Oriol Brufau --- components/layout_2020/layout_box_base.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'components/layout_2020/layout_box_base.rs') diff --git a/components/layout_2020/layout_box_base.rs b/components/layout_2020/layout_box_base.rs index bb2d37698f1..885ff0d26d3 100644 --- a/components/layout_2020/layout_box_base.rs +++ b/components/layout_2020/layout_box_base.rs @@ -63,6 +63,10 @@ impl LayoutBoxBase { *cache = Some((constraint_space.block_size, result)); result } + + pub(crate) fn invalidate_cached_fragment(&self) { + let _ = self.cached_layout_result.borrow_mut().take(); + } } impl Debug for LayoutBoxBase { -- cgit v1.2.3