mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibWeb: Sum horizontal margins to calculate space used by floats
This fixes the issue where max margin is used to find offset of floating box although horizonal margins do not collapse so they need to be summed instead.
This commit is contained in:
committed by
Andreas Kling
parent
90d8844c77
commit
202b24584f
@@ -1011,7 +1011,7 @@ BlockFormattingContext::SpaceUsedByFloats BlockFormattingContext::space_used_by_
|
||||
CSSPixels offset_from_containing_block_chain_margins_between_here_and_root = 0;
|
||||
for (auto const* containing_block = floating_box.box->containing_block(); containing_block && containing_block != &root(); containing_block = containing_block->containing_block()) {
|
||||
auto const& containing_block_state = m_state.get(*containing_block);
|
||||
offset_from_containing_block_chain_margins_between_here_and_root = max(offset_from_containing_block_chain_margins_between_here_and_root, containing_block_state.margin_box_left());
|
||||
offset_from_containing_block_chain_margins_between_here_and_root += containing_block_state.margin_box_left();
|
||||
}
|
||||
space_used_by_floats.left = offset_from_containing_block_chain_margins_between_here_and_root
|
||||
+ floating_box.offset_from_edge
|
||||
@@ -1030,7 +1030,7 @@ BlockFormattingContext::SpaceUsedByFloats BlockFormattingContext::space_used_by_
|
||||
CSSPixels offset_from_containing_block_chain_margins_between_here_and_root = 0;
|
||||
for (auto const* containing_block = floating_box.box->containing_block(); containing_block && containing_block != &root(); containing_block = containing_block->containing_block()) {
|
||||
auto const& containing_block_state = m_state.get(*containing_block);
|
||||
offset_from_containing_block_chain_margins_between_here_and_root = max(offset_from_containing_block_chain_margins_between_here_and_root, containing_block_state.margin_box_right());
|
||||
offset_from_containing_block_chain_margins_between_here_and_root += containing_block_state.margin_box_right();
|
||||
}
|
||||
space_used_by_floats.right = offset_from_containing_block_chain_margins_between_here_and_root
|
||||
+ floating_box.offset_from_edge
|
||||
|
||||
Reference in New Issue
Block a user