summaryrefslogtreecommitdiff
path: root/Source/WebCore/loader/cache/CachedFont.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/loader/cache/CachedFont.h')
-rw-r--r--Source/WebCore/loader/cache/CachedFont.h60
1 files changed, 31 insertions, 29 deletions
diff --git a/Source/WebCore/loader/cache/CachedFont.h b/Source/WebCore/loader/cache/CachedFont.h
index f19582b96..25d292f0f 100644
--- a/Source/WebCore/loader/cache/CachedFont.h
+++ b/Source/WebCore/loader/cache/CachedFont.h
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -23,61 +23,63 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CachedFont_h
-#define CachedFont_h
+#pragma once
#include "CachedResource.h"
#include "CachedResourceClient.h"
-#include "FontOrientation.h"
-#include "FontRenderingMode.h"
-#include "FontWidthVariant.h"
+#include "Font.h"
+#include "TextFlags.h"
namespace WebCore {
class CachedResourceLoader;
+class FontDescription;
class FontPlatformData;
class SVGDocument;
class SVGFontElement;
struct FontCustomPlatformData;
-class CachedFont final : public CachedResource {
+template <typename T> class FontTaggedSettings;
+typedef FontTaggedSettings<int> FontFeatureSettings;
+
+class CachedFont : public CachedResource {
public:
- CachedFont(const ResourceRequest&);
+ CachedFont(CachedResourceRequest&&, SessionID, Type = FontResource);
virtual ~CachedFont();
- void beginLoadIfNeeded(CachedResourceLoader* dl);
- virtual bool stillNeedsLoad() const override { return !m_loadInitiated; }
+ void beginLoadIfNeeded(CachedResourceLoader&);
+ bool stillNeedsLoad() const override { return !m_loadInitiated; }
+
+ virtual bool ensureCustomFontData(const AtomicString& remoteURI);
+ static std::unique_ptr<FontCustomPlatformData> createCustomFontData(SharedBuffer&, bool& wrapping);
+ static FontPlatformData platformDataFromCustomData(FontCustomPlatformData&, const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
- bool ensureCustomFontData();
- FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+ virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&);
-#if ENABLE(SVG_FONTS)
- bool ensureSVGFontData();
- SVGFontElement* getSVGFontById(const String&) const;
-#endif
+protected:
+ FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
+
+ bool ensureCustomFontData(SharedBuffer* data);
private:
- virtual void checkNotify() override;
- virtual bool mayTryReplaceEncodedData() const override;
+ void checkNotify() override;
+ bool mayTryReplaceEncodedData() const override;
- virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&) override;
+ void load(CachedResourceLoader&) override;
+ NO_RETURN_DUE_TO_ASSERT void setBodyDataFrom(const CachedResource&) final { ASSERT_NOT_REACHED(); }
- virtual void didAddClient(CachedResourceClient*) override;
- virtual void finishLoading(ResourceBuffer*) override;
+ void didAddClient(CachedResourceClient&) override;
+ void finishLoading(SharedBuffer*) override;
- virtual void allClientsRemoved() override;
+ void allClientsRemoved() override;
- std::unique_ptr<FontCustomPlatformData> m_fontData;
+ std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData;
bool m_loadInitiated;
bool m_hasCreatedFontDataWrappingResource;
-#if ENABLE(SVG_FONTS)
- RefPtr<SVGDocument> m_externalSVGDocument;
-#endif
-
friend class MemoryCache;
};
} // namespace WebCore
-#endif // CachedFont_h
+SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(CachedFont, CachedResource::FontResource)