1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

LibHTML: Move font loading from LayoutText to StyleProperties

Since LayoutText inherits all of its style information from its parent
Element anyway, it makes more sense to load the font at a higher level.

And since the font depends only on the style and nothing else, this
patch moves font loading (and caching) into StyleProperties. This could
be made a lot smarter to avoid loading the same font many times, etc.
This commit is contained in:
Andreas Kling 2019-10-06 11:23:58 +02:00
parent c8e5039418
commit b9557bf876
4 changed files with 72 additions and 66 deletions

View file

@ -3,7 +3,6 @@
#include <LibHTML/DOM/Text.h>
#include <LibHTML/Layout/LayoutNode.h>
class Font;
class LineBoxFragment;
class LayoutText : public LayoutNode {
@ -29,8 +28,4 @@ private:
void for_each_word(Callback) const;
template<typename Callback>
void for_each_source_line(Callback) const;
void load_font();
RefPtr<Font> m_font;
};