1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibWeb: Make FontCache per-StyleComputer

This effectively makes it per-Document, but we hang it off of
StyleComputer since that's what it's used for.

The purpose of this is to prevent downloaded fonts from escaping the
context that loaded them. There's probably a more elegant solution where
we still share caching of system fonts, but let's start here.
This commit is contained in:
Andreas Kling 2023-08-17 18:51:32 +02:00
parent 69a81243f5
commit 429b2e5860
6 changed files with 13 additions and 13 deletions

View file

@ -65,7 +65,7 @@ void ButtonPaintable::paint(PaintContext& context, PaintPhase phase) const
painter.draw_text(
text_rect.to_type<int>(),
static_cast<HTML::HTMLInputElement const&>(dom_node).value(),
FontCache::the().scaled_font(layout_box().font(), context.device_pixels_per_css_pixel()),
document().style_computer().font_cache().scaled_font(layout_box().font(), context.device_pixels_per_css_pixel()),
Gfx::TextAlignment::Center,
computed_values().color());
painter.restore();