mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibGfx+LibWeb: Move Gfx::ScaledFont caching from LibWeb into LibGfx
Before this change, we would only cache and reuse Gfx::ScaledFont instances for downloaded CSS fonts. By moving it into Gfx::VectorFont, we get caching for all vector fonts, including local system TTFs etc. This avoids a *lot* of style invalidations in LibWeb, since we now vend the same Gfx::Font pointer for the same font when used repeatedly.
This commit is contained in:
parent
bf8107b247
commit
f900957d26
16 changed files with 54 additions and 137 deletions
|
@ -16,7 +16,6 @@
|
|||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/FontCache.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
@ -48,8 +47,6 @@ 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::Type> = {}) const;
|
||||
|
@ -184,8 +181,6 @@ private:
|
|||
OwnPtr<RuleCache> m_user_agent_rule_cache;
|
||||
JS::Handle<CSSStyleSheet> m_user_style_sheet;
|
||||
|
||||
mutable FontCache m_font_cache;
|
||||
|
||||
using FontLoaderList = Vector<NonnullOwnPtr<FontLoader>>;
|
||||
HashMap<FontFaceKey, FontLoaderList> m_loaded_fonts;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue