From 83afc1154c93dafd5b4db93dd6e33501f897e10c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 18 Mar 2022 23:55:15 +0100 Subject: [PATCH] LibWeb: Fix IFC over-shrinking the available space for line boxes After accounting for left-side floats, we have to subtract the offset of the IFC's containing block again, to get the real starting X offset for the current line. This was done correctly in leftmost_x_offset_at() but incorrectly in available_space_for_line(), causing IFC to break lines too early in cases where the containing block had a non-zero X offset from the BFC root block. --- Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 5add103b76..c2ed35b489 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -57,7 +57,7 @@ float InlineFormattingContext::available_space_for_line(float y) const auto const& containing_block_state = m_state.get(containing_block()); auto const& root_block_state = m_state.get(parent().root()); - space.left = max(space.left, containing_block_state.offset.x()); + space.left = max(space.left, containing_block_state.offset.x()) - containing_block_state.offset.x(); space.right = min(root_block_state.content_width - space.right, containing_block_state.offset.x() + containing_block_state.content_width); return space.right - space.left;