mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +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:
parent
7abb512a86
commit
9e4226f353
3 changed files with 6 additions and 1 deletions
|
@ -291,7 +291,7 @@ void FlexFormattingContext::generate_anonymous_flex_items()
|
|||
|
||||
flex_container().for_each_child_of_type<Box>([&](Box& child_box) {
|
||||
// Skip anonymous text runs that are only whitespace.
|
||||
if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockContainer>()) {
|
||||
if (child_box.is_anonymous() && !child_box.is_generated() && !child_box.first_child_of_type<BlockContainer>()) {
|
||||
bool contains_only_white_space = true;
|
||||
child_box.for_each_in_subtree([&](auto const& node) {
|
||||
if (!is<TextNode>(node) || !static_cast<TextNode const&>(node).dom_node().data().is_whitespace()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue