1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +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

@ -16,6 +16,7 @@ class InitialValues {
public:
static float font_size() { return 10; }
static int font_weight() { return 400; }
static CSS::FontVariant font_variant() { return CSS::FontVariant::Normal; }
static CSS::Float float_() { return CSS::Float::None; }
static CSS::Clear clear() { return CSS::Clear::None; }
static CSS::Cursor cursor() { return CSS::Cursor::Auto; }
@ -178,6 +179,7 @@ public:
float font_size() const { return m_inherited.font_size; }
int font_weight() const { return m_inherited.font_weight; }
CSS::FontVariant font_variant() const { return m_inherited.font_variant; }
ComputedValues clone_inherited_values() const
{
@ -190,6 +192,7 @@ protected:
struct {
float font_size { InitialValues::font_size() };
int font_weight { InitialValues::font_weight() };
CSS::FontVariant font_variant { InitialValues::font_variant() };
Color color { InitialValues::color() };
CSS::Cursor cursor { InitialValues::cursor() };
CSS::ImageRendering image_rendering { InitialValues::image_rendering() };
@ -261,6 +264,7 @@ class MutableComputedValues final : public ComputedValues {
public:
void set_font_size(float font_size) { m_inherited.font_size = font_size; }
void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }
void set_font_variant(CSS::FontVariant font_variant) { m_inherited.font_variant = font_variant; }
void set_color(const Color& color) { m_inherited.color = color; }
void set_content(ContentData const& content) { m_noninherited.content = content; }
void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; }