mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 08:30:50 +00:00
LibWeb: Add absolutized
method for FontStyleStyleValue
This commit is contained in:
parent
28451b16c9
commit
8284a99f0a
Notes:
github-actions[bot]
2025-10-20 15:14:13 +00:00
Author: https://github.com/Calme1709
Commit: 8284a99f0a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6426
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 16 additions and 14 deletions
|
@ -50,11 +50,23 @@ String FontStyleStyleValue::to_string(SerializationMode mode) const
|
|||
builder.append(CSS::to_string(m_font_style));
|
||||
// https://drafts.csswg.org/css-fonts/#valdef-font-style-oblique-angle--90deg-90deg
|
||||
// The lack of an <angle> represents 14deg. (Note that a font might internally provide its own mapping for "oblique", but the mapping within the font is disregarded.)
|
||||
static auto default_angle = Angle::make_degrees(14);
|
||||
if (angle_string.has_value() && !(m_angle_value->is_angle() && m_angle_value->as_angle().angle() == default_angle))
|
||||
if (angle_string.has_value() && angle_string != "14deg"sv)
|
||||
builder.appendff(" {}", angle_string);
|
||||
|
||||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue const> FontStyleStyleValue::absolutized(ComputationContext const& computation_context) const
|
||||
{
|
||||
ValueComparingRefPtr<StyleValue const> absolutized_angle;
|
||||
|
||||
if (m_angle_value)
|
||||
absolutized_angle = m_angle_value->absolutized(computation_context);
|
||||
|
||||
if (absolutized_angle == m_angle_value)
|
||||
return *this;
|
||||
|
||||
return FontStyleStyleValue::create(m_font_style, absolutized_angle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue