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

LibWeb: Create flex items for empty generated boxes

I couldn't find anything in the specs about this, but GMail uses
empty generated boxes (`::before` and `::after` with `content: ""`)
inside a flexbox container in order to vertically center things.

The flexbox spec tells us to not generate flex items for empty
*anonymous* boxes, so we continue not doing that, but generated boxes
(any pseudo-element box) now always produce a flex item. This probably
isn't perfect either, and we'll have to revisit it for stuff like
`::first-letter`.
This commit is contained in:
Andreas Kling 2022-09-28 17:11:23 +02:00
parent 7abb512a86
commit 9e4226f353
3 changed files with 6 additions and 1 deletions

View file

@ -41,6 +41,9 @@ public:
DOM::Node const* dom_node() const;
DOM::Node* dom_node();
bool is_generated() const { return m_generated; }
void set_generated(bool b) { m_generated = b; }
Painting::Paintable* paintable() { return m_paintable; }
Painting::Paintable const* paintable() const { return m_paintable; }
void set_paintable(RefPtr<Painting::Paintable>);
@ -153,6 +156,7 @@ private:
SelectionState m_selection_state { SelectionState::None };
bool m_is_flex_item { false };
bool m_generated { false };
};
class NodeWithStyle : public Node {