LibWeb: Move to_font_slope from StyleValue to FontStyleStyleValue

This method only operated on `FontStyleStyleValue`s anyway so this is a
better place to have it
This commit is contained in:
Callum Law 2025-09-02 22:41:48 +12:00 committed by Sam Atkins
commit 10793aef56
Notes: github-actions[bot] 2025-09-19 09:07:50 +00:00
6 changed files with 33 additions and 26 deletions

View file

@ -151,25 +151,4 @@ GC::Ref<CSSStyleValue> StyleValue::reify(JS::Realm& realm, String const& associa
return CSSStyleValue::create(realm, associated_property, to_string(SerializationMode::Normal));
}
int StyleValue::to_font_slope() const
{
// FIXME: Implement oblique <angle>
if (is_font_style()) {
switch (as_font_style().font_style()) {
case FontStyle::Italic:
static int italic_slope = Gfx::name_to_slope("Italic"sv);
return italic_slope;
case FontStyle::Oblique:
static int oblique_slope = Gfx::name_to_slope("Oblique"sv);
return oblique_slope;
case FontStyle::Normal:
default:
static int normal_slope = Gfx::name_to_slope("Normal"sv);
return normal_slope;
}
}
static int normal_slope = Gfx::name_to_slope("Normal"sv);
return normal_slope;
}
}