diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-28 11:34:15 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-28 14:17:44 +0100 |
commit | c9ab9e2c64f01c97712ca46e5531586def0bb440 (patch) | |
tree | 9fea264edc0d02f7e47c44a33584adb22e3fa6b7 /Userland/Libraries/LibWeb | |
parent | 20caea2f86e3f48320b8749dcc8118cc775bdbcc (diff) | |
download | serenity-c9ab9e2c64f01c97712ca46e5531586def0bb440.zip |
LibWeb: Blockify children of parents with display:grid or display:flex
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 6cd2c26a45..050d0ac08d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -923,7 +923,7 @@ enum class BoxTypeTransformation { Inlinify, }; -static BoxTypeTransformation required_box_type_transformation(StyleProperties const& style, DOM::Element const&, Optional<CSS::Selector::PseudoElement> const&) +static BoxTypeTransformation required_box_type_transformation(StyleProperties const& style, DOM::Element const& element, Optional<CSS::Selector::PseudoElement> const&) { auto display = style.display(); @@ -933,7 +933,12 @@ static BoxTypeTransformation required_box_type_transformation(StyleProperties co // FIXME: Containment in a ruby container inlinifies the box’s display type, as described in [CSS-RUBY-1]. - // FIXME: A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1] + // A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1] + if (element.parent() && element.parent()->layout_node()) { + auto const& parent_display = element.parent()->layout_node()->computed_values().display(); + if (parent_display.is_grid_inside() || parent_display.is_flex_inside()) + return BoxTypeTransformation::Blockify; + } return BoxTypeTransformation::None; } |