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

LibWeb: Blockify inline-flex to flex

Previously, `inline-flex` would blockify to `block` since blockification
didn't take the inner display type into account. This is still not
perfect, but it fixes a lot of situations where inline-level flex
containers would be demoted to regular block containers.
This commit is contained in:
Andreas Kling 2022-07-19 15:31:01 +02:00
parent ed8930fff5
commit cf4b7e343a

View file

@ -1132,8 +1132,15 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El
case BoxTypeTransformation::None: case BoxTypeTransformation::None:
break; break;
case BoxTypeTransformation::Blockify: case BoxTypeTransformation::Blockify:
if (!display.is_block_outside()) if (!display.is_block_outside()) {
style.set_property(CSS::PropertyID::Display, IdentifierStyleValue::create(CSS::ValueID::Block)); // FIXME: We only want to change the outer display type here, but we don't have a nice API
// to do that specifically. For now, we simply check for "inline-flex" and convert
// that to "flex".
if (display.is_flex_inside())
style.set_property(CSS::PropertyID::Display, IdentifierStyleValue::create(CSS::ValueID::Flex));
else
style.set_property(CSS::PropertyID::Display, IdentifierStyleValue::create(CSS::ValueID::Block));
}
break; break;
case BoxTypeTransformation::Inlinify: case BoxTypeTransformation::Inlinify:
if (!display.is_inline_outside()) if (!display.is_inline_outside())