LibWeb+LibWebView: Allow to specify default font size in FontPlugin

Instead of always assuming 12pt size for default font, explicitly pass
it as a parameter.
This commit is contained in:
Aliaksandr Kalenik 2025-01-02 03:56:05 +03:00 committed by Andreas Kling
commit 0b8b690f92
Notes: github-actions[bot] 2025-01-02 09:48:33 +00:00
9 changed files with 22 additions and 24 deletions

View file

@ -228,7 +228,7 @@ Color ComputedProperties::color_or_fallback(CSS::PropertyID id, Layout::NodeWith
return value.to_color(node);
}
NonnullRefPtr<Gfx::Font const> ComputedProperties::font_fallback(bool monospace, bool bold)
NonnullRefPtr<Gfx::Font const> ComputedProperties::font_fallback(bool monospace, bool bold, float point_size)
{
if (monospace && bold)
return Platform::FontPlugin::the().default_fixed_width_font().bold_variant();
@ -237,9 +237,9 @@ NonnullRefPtr<Gfx::Font const> ComputedProperties::font_fallback(bool monospace,
return Platform::FontPlugin::the().default_fixed_width_font();
if (bold)
return Platform::FontPlugin::the().default_font().bold_variant();
return Platform::FontPlugin::the().default_font(point_size)->bold_variant();
return Platform::FontPlugin::the().default_font();
return *Platform::FontPlugin::the().default_font(point_size);
}
CSSPixels ComputedProperties::compute_line_height(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const