LibWeb: Make things aware of box-sizing

Of course, we don't actually *use* the box-sizing property yet, but the
value is applied and shows up in the computed style.
This commit is contained in:
Sam Atkins 2021-10-05 16:55:02 +01:00 committed by Andreas Kling
parent 3c192f492a
commit fc7af21c7c
Notes: sideshowbarker 2024-07-18 03:01:37 +09:00
6 changed files with 41 additions and 0 deletions

View file

@ -33,6 +33,17 @@ String ResolvedCSSStyleDeclaration::item(size_t index) const
return {};
}
static CSS::ValueID to_css_value_id(CSS::BoxSizing value)
{
switch (value) {
case CSS::BoxSizing::BorderBox:
return CSS::ValueID::BorderBox;
case CSS::BoxSizing::ContentBox:
return CSS::ValueID::ContentBox;
}
VERIFY_NOT_REACHED();
}
static CSS::ValueID to_css_value_id(CSS::Display value)
{
switch (value) {
@ -546,6 +557,8 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
}
case CSS::PropertyID::ListStyleType:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().list_style_type()));
case CSS::PropertyID::BoxSizing:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().box_sizing()));
case CSS::PropertyID::Invalid:
return IdentifierStyleValue::create(CSS::ValueID::Invalid);
case CSS::PropertyID::Custom: