mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Honor negative margins on atomic inlines
Sizing already worked correctly, but before this change, we were too aggressive with inserting line breaks when negative margins would still an atomic inline to fit on the line.
This commit is contained in:
parent
3ae29fdeec
commit
7abb182fa3
Notes:
sideshowbarker
2024-07-16 18:06:41 +09:00
Author: https://github.com/awesomekling
Commit: 7abb182fa3
Pull-request: https://github.com/SerenityOS/serenity/pull/22234
5 changed files with 80 additions and 1 deletions
|
@ -275,7 +275,12 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
|
|||
auto& box = verify_cast<Layout::Box>(*item.node);
|
||||
compute_inset(box);
|
||||
if (containing_block().computed_values().white_space() != CSS::WhiteSpace::Nowrap) {
|
||||
line_builder.break_if_needed(item.border_box_width());
|
||||
auto minimum_space_needed_on_line = item.border_box_width();
|
||||
if (item.margin_start < 0)
|
||||
minimum_space_needed_on_line += item.margin_start;
|
||||
if (item.margin_end < 0)
|
||||
minimum_space_needed_on_line += item.margin_end;
|
||||
line_builder.break_if_needed(minimum_space_needed_on_line);
|
||||
}
|
||||
line_builder.append_box(box, item.border_start + item.padding_start, item.padding_end + item.border_end, item.margin_start, item.margin_end);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue