1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibWeb: Parse CSS "font-variant" as part of "font"

This allows us to parse CSS "font" values that contain e.g "small-caps"
or "normal", as used on Acid3.
This commit is contained in:
Andreas Kling 2022-03-23 14:54:21 +01:00
parent 632928a11e
commit 5118a4c1e7
6 changed files with 37 additions and 1 deletions

View file

@ -999,4 +999,20 @@ Variant<CSS::VerticalAlign, CSS::LengthPercentage> StyleProperties::vertical_ali
VERIFY_NOT_REACHED();
}
Optional<CSS::FontVariant> StyleProperties::font_variant() const
{
auto value = property(CSS::PropertyID::FontVariant);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::Normal:
return CSS::FontVariant::Normal;
case CSS::ValueID::SmallCaps:
return CSS::FontVariant::SmallCaps;
default:
return {};
}
}
}