summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSSegmentedFontFace.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/css/CSSSegmentedFontFace.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/css/CSSSegmentedFontFace.h')
-rw-r--r--Source/WebCore/css/CSSSegmentedFontFace.h64
1 files changed, 22 insertions, 42 deletions
diff --git a/Source/WebCore/css/CSSSegmentedFontFace.h b/Source/WebCore/css/CSSSegmentedFontFace.h
index fb2b4a730..f66e73393 100644
--- a/Source/WebCore/css/CSSSegmentedFontFace.h
+++ b/Source/WebCore/css/CSSSegmentedFontFace.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,65 +23,45 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CSSSegmentedFontFace_h
-#define CSSSegmentedFontFace_h
+#pragma once
+#include "CSSFontFace.h"
+#include "FontCache.h"
#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
-#include <wtf/unicode/Unicode.h>
namespace WebCore {
-class CSSFontFace;
class CSSFontSelector;
-class FontData;
class FontDescription;
-class SegmentedFontData;
+class FontRanges;
-class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> {
+class CSSSegmentedFontFace final : public RefCounted<CSSSegmentedFontFace>, public CSSFontFace::Client {
+ WTF_MAKE_FAST_ALLOCATED;
public:
- static PassRefPtr<CSSSegmentedFontFace> create(CSSFontSelector* selector) { return adoptRef(new CSSSegmentedFontFace(selector)); }
+ static Ref<CSSSegmentedFontFace> create()
+ {
+ return adoptRef(*new CSSSegmentedFontFace());
+ }
~CSSSegmentedFontFace();
- CSSFontSelector* fontSelector() const { return m_fontSelector; }
+ void appendFontFace(Ref<CSSFontFace>&&);
- void fontLoaded(CSSFontFace*);
+ FontRanges fontRanges(const FontDescription&);
- void appendFontFace(PassRefPtr<CSSFontFace>);
+ Vector<Ref<CSSFontFace>, 1>& constituentFaces() { return m_fontFaces; }
- PassRefPtr<FontData> getFontData(const FontDescription&);
-
-#if ENABLE(FONT_LOAD_EVENTS)
- class LoadFontCallback : public RefCounted<LoadFontCallback> {
- public:
- virtual ~LoadFontCallback() { }
- virtual void notifyLoaded() = 0;
- virtual void notifyError() = 0;
- };
-
- bool checkFont() const;
- void loadFont(const FontDescription&, PassRefPtr<LoadFontCallback> loadCallback);
-#endif
+ // CSSFontFace::Client needs to be able to be held in a RefPtr.
+ void ref() final { RefCounted<CSSSegmentedFontFace>::ref(); }
+ void deref() final { RefCounted<CSSSegmentedFontFace>::deref(); }
private:
- CSSSegmentedFontFace(CSSFontSelector*);
+ CSSSegmentedFontFace();
+ void fontLoaded(CSSFontFace&) final;
- void pruneTable();
- bool isValid() const;
-#if ENABLE(FONT_LOAD_EVENTS)
- bool isLoading() const;
-#endif
-
- CSSFontSelector* m_fontSelector;
- HashMap<unsigned, RefPtr<SegmentedFontData>> m_fontDataTable;
- Vector<RefPtr<CSSFontFace>, 1> m_fontFaces;
-#if ENABLE(FONT_LOAD_EVENTS)
- Vector<RefPtr<LoadFontCallback>> m_callbacks;
-#endif
+ HashMap<FontDescriptionKey, FontRanges, FontDescriptionKeyHash, WTF::SimpleClassHashTraits<FontDescriptionKey>> m_cache;
+ Vector<Ref<CSSFontFace>, 1> m_fontFaces;
};
} // namespace WebCore
-
-#endif // CSSSegmentedFontFace_h