summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSFontFaceSource.h
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/css/CSSFontFaceSource.h
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/css/CSSFontFaceSource.h')
-rw-r--r--Source/WebCore/css/CSSFontFaceSource.h76
1 files changed, 40 insertions, 36 deletions
diff --git a/Source/WebCore/css/CSSFontFaceSource.h b/Source/WebCore/css/CSSFontFaceSource.h
index 1154373f7..1e29b57ff 100644
--- a/Source/WebCore/css/CSSFontFaceSource.h
+++ b/Source/WebCore/css/CSSFontFaceSource.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
@@ -28,65 +28,69 @@
#include "CachedFontClient.h"
#include "CachedResourceHandle.h"
-#include "Timer.h"
-#include <wtf/HashMap.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
-class CachedFont;
class CSSFontFace;
class CSSFontSelector;
+class Font;
+struct FontCustomPlatformData;
class FontDescription;
-class SimpleFontData;
-#if ENABLE(SVG_FONTS)
-class SVGFontElement;
+class FontFeatureSettings;
+struct FontVariantSettings;
class SVGFontFaceElement;
-#endif
+class SharedBuffer;
-class CSSFontFaceSource : public CachedFontClient {
+class CSSFontFaceSource final : public CachedFontClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
- CSSFontFaceSource(const String&, CachedFont* = 0);
- virtual ~CSSFontFaceSource();
-
- bool isLoaded() const;
- bool isValid() const;
- const AtomicString& string() const { return m_string; }
-
- void setFontFace(CSSFontFace* face) { m_face = face; }
+ // => Success
+ // //
+ // Pending => Loading
+ // \\.
+ // => Failure
+ enum class Status {
+ Pending,
+ Loading,
+ Success,
+ Failure
+ };
+
+ CSSFontFaceSource(CSSFontFace& owner, const String& familyNameOrURI, CachedFont* = nullptr, SVGFontFaceElement* = nullptr);
+ virtual ~CSSFontFaceSource();
- virtual void fontLoaded(CachedFont*);
+ Status status() const { return m_status; }
- PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
+ const AtomicString& familyNameOrURI() const { return m_familyNameOrURI; }
- void pruneTable();
+ void load(CSSFontSelector&);
+ RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&);
#if ENABLE(SVG_FONTS)
- SVGFontFaceElement* svgFontFaceElement() const;
- void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement>);
bool isSVGFontFaceSource() const;
- void setHasExternalSVGFont(bool value) { m_hasExternalSVGFont = value; }
-#endif
-
-#if ENABLE(FONT_LOAD_EVENTS)
- bool isDecodeError() const;
- bool ensureFontData();
#endif
private:
- void startLoadingTimerFired(Timer<CSSFontFaceSource>*);
+ virtual void fontLoaded(CachedFont&) override;
+
+ void setStatus(Status);
- AtomicString m_string; // URI for remote, built-in font name for local.
+ AtomicString m_familyNameOrURI; // URI for remote, built-in font name for local.
CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
- CSSFontFace* m_face; // Our owning font face.
- HashMap<unsigned, RefPtr<SimpleFontData> > m_fontDataTable; // The hash key is composed of size synthetic styles.
+ CSSFontFace& m_face; // Our owning font face.
-#if ENABLE(SVG_FONTS)
+#if ENABLE(SVG_OTF_CONVERTER)
+ RefPtr<SharedBuffer> m_generatedOTFBuffer;
+#endif
+
+#if ENABLE(SVG_FONTS) || ENABLE(SVG_OTF_CONVERTER)
RefPtr<SVGFontFaceElement> m_svgFontFaceElement;
- RefPtr<SVGFontElement> m_externalSVGFontElement;
- bool m_hasExternalSVGFont;
+ std::unique_ptr<FontCustomPlatformData> m_inDocumentCustomPlatformData;
#endif
+
+ Status m_status { Status::Pending };
};
}