LibWeb/CSS: Resolve used value for the inline-size property

This commit is contained in:
Tim Ledbetter 2025-03-09 20:28:59 +00:00 committed by Sam Atkins
commit 53bf0ef225
Notes: github-actions[bot] 2025-03-10 13:02:08 +00:00
5 changed files with 67 additions and 4 deletions

View file

@ -243,7 +243,7 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
// -> block-size
// -> height
// FIXME: -> inline-size
// -> inline-size
// -> margin-block-end
// -> margin-block-start
// -> margin-bottom
@ -277,6 +277,13 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
return style_value_for_size(Size::make_px(maybe_used_height.release_value()));
return style_value_for_size(layout_node.computed_values().height());
}
case PropertyID::InlineSize: {
auto writing_mode = layout_node.computed_values().writing_mode();
auto is_vertically_oriented = first_is_one_of(writing_mode, WritingMode::VerticalLr, WritingMode::VerticalRl);
if (is_vertically_oriented)
return style_value_for_property(layout_node, PropertyID::Height);
return style_value_for_property(layout_node, PropertyID::Width);
}
case PropertyID::MarginBlockEnd:
if (auto maybe_used_value = used_value_for_property([&](auto const& paintable_box) { return pixels_for_pixel_box_logical_side(layout_node, paintable_box.box_model().margin, LogicalSide::BlockEnd); }); maybe_used_value.has_value())
return LengthStyleValue::create(Length::make_px(maybe_used_value.release_value()));