mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 05:29:56 +00:00
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:
parent
425b7de44a
commit
10793aef56
Notes:
github-actions[bot]
2025-09-19 09:07:50 +00:00
Author: https://github.com/Calme1709
Commit: 10793aef56
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6072
Reviewed-by: https://github.com/AtkinsSJ ✅
6 changed files with 33 additions and 26 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "FontStyleStyleValue.h"
|
||||
#include <LibGfx/Font/FontStyleMapping.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValue.h>
|
||||
|
@ -20,6 +21,23 @@ FontStyleStyleValue::FontStyleStyleValue(FontStyle font_style, ValueComparingRef
|
|||
|
||||
FontStyleStyleValue::~FontStyleStyleValue() = default;
|
||||
|
||||
int FontStyleStyleValue::to_font_slope() const
|
||||
{
|
||||
// FIXME: Implement oblique <angle>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
String FontStyleStyleValue::to_string(SerializationMode mode) const
|
||||
{
|
||||
Optional<String> angle_string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue