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

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
6 changed files with 41 additions and 0 deletions

View file

@ -728,4 +728,20 @@ Optional<CSS::BoxShadowData> StyleProperties::box_shadow() const
auto& box = value->as_box_shadow();
return { { box.offset_x(), box.offset_y(), box.blur_radius(), box.color() } };
}
CSS::BoxSizing StyleProperties::box_sizing() const
{
auto value = property(CSS::PropertyID::BoxSizing);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::BorderBox:
return CSS::BoxSizing::BorderBox;
case CSS::ValueID::ContentBox:
return CSS::BoxSizing::ContentBox;
default:
return {};
}
}
}