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.
This commit is contained in:
Andreas Kling 2022-03-18 23:55:15 +01:00
parent 8d5768b103
commit 83afc1154c

View file

@ -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;