diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/loader/cache/CachedFont.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/loader/cache/CachedFont.h')
-rw-r--r-- | Source/WebCore/loader/cache/CachedFont.h | 60 |
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) |