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:
parent
69a81243f5
commit
429b2e5860
6 changed files with 13 additions and 13 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <LibWeb/CSS/Parser/TokenStream.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/FontCache.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
@ -67,6 +68,8 @@ public:
|
|||
DOM::Document& document() { return m_document; }
|
||||
DOM::Document const& document() const { return m_document; }
|
||||
|
||||
FontCache& font_cache() const { return m_font_cache; }
|
||||
|
||||
NonnullRefPtr<StyleProperties> create_document_style() const;
|
||||
|
||||
ErrorOr<NonnullRefPtr<StyleProperties>> compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement> = {}) const;
|
||||
|
@ -201,6 +204,8 @@ private:
|
|||
OwnPtr<RuleCache> m_author_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_agent_rule_cache;
|
||||
|
||||
mutable FontCache m_font_cache;
|
||||
|
||||
HashMap<FontFaceKey, NonnullOwnPtr<FontLoader>> m_loaded_fonts;
|
||||
|
||||
Length::FontMetrics m_default_font_metrics;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue