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

Revert "LibWeb: Make TextNode::ChunkIterator emit an empty chunk for content:"""

This reverts commit b062a0fb7c.

This made a calculation of pseudo-elements' height incorrect when they
had `height` set to `auto` and used other techniques (like setting
`padding-top`) to set height, as it was now also adding an empty line.

Additionally, the case didn't work for content containing whitespace
characters, so a pseudo-element with `content: " "` didn't have *this*
particular problem.
This commit is contained in:
Karol Kosek 2023-07-11 12:28:47 +02:00 committed by Andreas Kling
parent cf2c2cb4d7
commit d4b5205482
3 changed files with 3 additions and 16 deletions

View file

@ -124,10 +124,9 @@ void TextNode::compute_text_for_rendering()
m_text_for_rendering = builder.to_deprecated_string();
}
TextNode::ChunkIterator::ChunkIterator(StringView text, bool wrap_lines, bool respect_linebreaks, bool is_generated_empty_string)
TextNode::ChunkIterator::ChunkIterator(StringView text, bool wrap_lines, bool respect_linebreaks)
: m_wrap_lines(wrap_lines)
, m_respect_linebreaks(respect_linebreaks)
, m_should_emit_one_empty_chunk(is_generated_empty_string)
, m_utf8_view(text)
, m_iterator(m_utf8_view.begin())
{
@ -135,17 +134,6 @@ TextNode::ChunkIterator::ChunkIterator(StringView text, bool wrap_lines, bool re
Optional<TextNode::Chunk> TextNode::ChunkIterator::next()
{
if (m_should_emit_one_empty_chunk) {
m_should_emit_one_empty_chunk = false;
return Chunk {
.view = {},
.start = 0,
.length = 0,
.has_breaking_newline = false,
.is_all_whitespace = false,
};
}
if (m_iterator == m_utf8_view.end())
return {};