1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWeb: Don't break on *every character* in AllPossibleLineBreaks mode

This mode is used to find the min-content inline size, so we should
break between words, not characters.
This commit is contained in:
Andreas Kling 2022-03-05 13:06:04 +01:00
parent 32bd57bdc9
commit e61bf997db

View file

@ -277,12 +277,6 @@ Optional<TextNode::Chunk> TextNode::ChunkIterator::next()
return result.release_value();
}
if (m_layout_mode == LayoutMode::AllPossibleLineBreaks) {
if (auto result = try_commit_chunk(start_of_chunk, m_iterator, false); result.has_value()) {
return result.release_value();
}
}
// NOTE: The checks after this need to look at the current iterator
// position, which depends on not being at the end.
if (m_iterator == m_utf8_view.end())
@ -300,7 +294,7 @@ Optional<TextNode::Chunk> TextNode::ChunkIterator::next()
}
}
if (m_wrap_lines) {
if (m_wrap_lines || m_layout_mode == LayoutMode::AllPossibleLineBreaks) {
bool is_space = is_ascii_space(*m_iterator);
if (is_space != m_last_was_space) {
m_last_was_space = is_space;