ソースを参照

LibWeb: Move FontCache into the Web namespace

Andreas Kling 1 年間 前
コミット
c98829f7c9

+ 4 - 0
Userland/Libraries/LibWeb/FontCache.cpp

@@ -8,6 +8,8 @@
 #include <LibGfx/Font/Font.h>
 #include <LibWeb/FontCache.h>
 
+namespace Web {
+
 RefPtr<Gfx::Font const> FontCache::get(FontSelector const& font_selector) const
 {
     auto cached_font = m_fonts.get(font_selector);
@@ -36,3 +38,5 @@ void FontCache::set(FontSelector const& font_selector, NonnullRefPtr<Gfx::Font c
 {
     m_fonts.set(font_selector, move(font));
 }
+
+}

+ 12 - 7
Userland/Libraries/LibWeb/FontCache.h

@@ -10,6 +10,9 @@
 #include <AK/HashMap.h>
 #include <LibGfx/Font/Font.h>
 #include <LibGfx/Forward.h>
+#include <LibWeb/Forward.h>
+
+namespace Web {
 
 struct FontSelector {
     FlyString family;
@@ -24,13 +27,6 @@ struct FontSelector {
     }
 };
 
-namespace AK {
-template<>
-struct Traits<FontSelector> : public GenericTraits<FontSelector> {
-    static unsigned hash(FontSelector const& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); }
-};
-}
-
 class FontCache {
 public:
     FontCache() = default;
@@ -42,3 +38,12 @@ public:
 private:
     mutable HashMap<FontSelector, NonnullRefPtr<Gfx::Font const>> m_fonts;
 };
+
+}
+
+namespace AK {
+template<>
+struct Traits<Web::FontSelector> : public GenericTraits<Web::FontSelector> {
+    static unsigned hash(Web::FontSelector const& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); }
+};
+}