From 871a9bf677525293d6a3ac46b55660aaee02281b Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Thu, 14 Mar 2024 10:55:01 +0100 Subject: [PATCH] layout: IFCs should not always be marked as containing floats (#31641) Marking all IFCs as containing floats shouldn't change layout results, but does prevent parallel layout in some cases. This change fixes an issue where we were marking all IFCs as containing floats. Fixes #31540. --- components/layout_2020/flow/inline.rs | 4 +++- components/layout_2020/flow/mod.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index c84e2a7eead..11b8f4a5ce5 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -971,7 +971,9 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> { match text_align { TextAlign::Start => text_indent, TextAlign::End => (available_space - line_length).max(text_indent), - TextAlign::Center => (available_space - line_length + text_indent) / 2., + TextAlign::Center => { + ((available_space - line_length + text_indent) / 2.).max(text_indent) + }, }; // Calculate the justification adjustment. This is simply the remaining space on the line, diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 9c5cae51877..8a0b1735006 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -64,7 +64,7 @@ impl BlockContainer { BlockContainer::BlockLevelBoxes(boxes) => boxes .iter() .any(|block_level_box| block_level_box.borrow().contains_floats()), - BlockContainer::InlineFormattingContext { .. } => true, + BlockContainer::InlineFormattingContext(context) => context.contains_floats, } } }