1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +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

@ -79,12 +79,10 @@ void LineBuilder::append_text_chunk(TextNode const& text_node, size_t offset_in_
m_max_height_on_current_line = max(m_max_height_on_current_line, content_height);
}
bool LineBuilder::should_break(LayoutMode layout_mode, float next_item_width, bool should_force_break)
bool LineBuilder::should_break(LayoutMode layout_mode, float next_item_width)
{
if (layout_mode == LayoutMode::MinContent)
return true;
if (should_force_break)
return true;
if (layout_mode == LayoutMode::MaxContent)
return false;
auto const& line_boxes = m_containing_block_state.line_boxes;