From aeeb3cb4888df62c44bf694ce18437fd8699b5d7 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Thu, 18 Sep 2025 23:00:16 +0200 Subject: [PATCH] layout: Avoid recomputing automatic inline size (#39375) Laying out a block-level box that establishes an independent formatting context may require multiple attempts because it needs to avoid floats. We were previously recomputing the automatic inline size every time, even if it was always the same. Now we will only compute it once. Testing: Not needed, no behavior change Signed-off-by: Oriol Brufau --- components/layout/flow/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/layout/flow/mod.rs b/components/layout/flow/mod.rs index 733d36f3d6a..45b0940b866 100644 --- a/components/layout/flow/mod.rs +++ b/components/layout/flow/mod.rs @@ -1375,11 +1375,12 @@ impl IndependentFormattingContext { }; let justify_self = resolve_justify_self(style, containing_block.style); - let is_replaced = self.is_replaced(); + let automatic_inline_size = + automatic_inline_size(justify_self, is_table, self.is_replaced()); let compute_inline_size = |stretch_size| { content_box_sizes.inline.resolve( Direction::Inline, - automatic_inline_size(justify_self, is_table, is_replaced), + automatic_inline_size, Au::zero, Some(stretch_size), get_inline_content_sizes,