mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +00:00
LibWeb: Change inline float clearance to not reset margin collapsing
When a block container has `clear` set and some clearance is applied, that clearance prevents margins from adjoining and therefore resets the margin state. But when a floating box has `clear` set, that clearance only goes between floating boxes so should not reset margin state. BlockFormattingContexts already do that correctly, and this PR changes InlineFormattingContext to do the same. Fixes #1462; adds reduced input from that issue as test.
This commit is contained in:
parent
c77d9a2732
commit
9075f64cac
Notes:
github-actions[bot]
2024-09-20 23:56:34 +00:00
Author: https://github.com/pavpanchekha 🔰
Commit: 9075f64cac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1464
3 changed files with 39 additions and 3 deletions
|
@ -314,9 +314,11 @@ void InlineFormattingContext::generate_line_boxes()
|
|||
|
||||
case InlineLevelIterator::Item::Type::FloatingElement:
|
||||
if (is<Box>(*item.node)) {
|
||||
auto introduce_clearance = parent().clear_floating_boxes(*item.node, *this);
|
||||
if (introduce_clearance == BlockFormattingContext::DidIntroduceClearance::Yes)
|
||||
parent().reset_margin_state();
|
||||
[[maybe_unused]] auto introduce_clearance = parent().clear_floating_boxes(*item.node, *this);
|
||||
// Even if this introduces clearance, we do NOT reset
|
||||
// the margin state, because that is clearance between
|
||||
// floats and does not contribute to the height of the
|
||||
// Inline Formatting Context.
|
||||
parent().layout_floating_box(static_cast<Layout::Box const&>(*item.node), containing_block(), *m_available_space, 0, &line_builder);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue