1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

LibWeb: Make text newlines in "pre" mode emit a ForcedBreak item

Instead of emitting a Text item with the "should_force_break" flag set
to true, newlines in newline-preserving text content now timply turn
into ForcedBreak items. This makes the <pre> element work again.
This commit is contained in:
Andreas Kling 2022-03-26 18:59:54 +01:00
parent d32630e17b
commit aefe1727fc
6 changed files with 14 additions and 11 deletions

View file

@ -241,7 +241,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
break;
case InlineLevelIterator::Item::Type::Element: {
auto& box = verify_cast<Layout::Box>(*item.node);
line_builder.break_if_needed(layout_mode, item.border_box_width(), item.should_force_break);
line_builder.break_if_needed(layout_mode, item.border_box_width());
line_builder.append_box(box, item.border_start + item.padding_start, item.padding_end + item.border_end, item.margin_start, item.margin_end);
break;
}
@ -257,7 +257,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
case InlineLevelIterator::Item::Type::Text: {
auto& text_node = verify_cast<Layout::TextNode>(*item.node);
if (line_builder.break_if_needed(layout_mode, item.border_box_width(), item.should_force_break)) {
if (line_builder.break_if_needed(layout_mode, item.border_box_width())) {
if (item.is_collapsible_whitespace)
break;
}