1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:37:45 +00:00

LibWeb: Don't drop single <br/> lines

Previously, when having inline contexts consisting of just a `<br/>`
tag, we would not create a line box.

Ensure that there is always a line box when a line is explicitly being
broken and also ensure it won't be trimmed due to being empty.

This will a fix a number of sites that use `<br>` tags for layouts
between block elements (even though the spec says they shouldn't).
This commit is contained in:
Mathis Wiehl 2023-03-15 21:11:38 +01:00 committed by Sam Atkins
parent 2fe4be40af
commit 9927dab993
4 changed files with 29 additions and 2 deletions

View file

@ -28,7 +28,7 @@ public:
void trim_trailing_whitespace();
bool is_empty_or_ends_in_whitespace() const;
bool is_empty() const { return m_fragments.is_empty(); }
bool is_empty() const { return m_fragments.is_empty() && !m_has_break; }
private:
friend class BlockContainer;
@ -40,6 +40,7 @@ private:
CSSPixels m_height { 0 };
CSSPixels m_bottom { 0 };
CSSPixels m_baseline { 0 };
bool m_has_break { false };
};
}