OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 class FontDescription; | 42 class FontDescription; |
43 class RemoteFontFaceSource; | 43 class RemoteFontFaceSource; |
44 class SimpleFontData; | 44 class SimpleFontData; |
45 | 45 |
46 class CORE_EXPORT CSSFontFace final : public NoBaseWillBeGarbageCollectedFinaliz
ed<CSSFontFace> { | 46 class CORE_EXPORT CSSFontFace final : public NoBaseWillBeGarbageCollectedFinaliz
ed<CSSFontFace> { |
47 USING_FAST_MALLOC_WILL_BE_REMOVED(CSSFontFace); | 47 USING_FAST_MALLOC_WILL_BE_REMOVED(CSSFontFace); |
48 WTF_MAKE_NONCOPYABLE(CSSFontFace); | 48 WTF_MAKE_NONCOPYABLE(CSSFontFace); |
49 public: | 49 public: |
50 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) | 50 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) |
51 : m_ranges(ranges) | 51 : m_ranges(adoptRef(new UnicodeRangeSet(ranges))) |
52 , m_segmentedFontFace(nullptr) | 52 , m_segmentedFontFace(nullptr) |
53 , m_fontFace(fontFace) | 53 , m_fontFace(fontFace) |
54 { | 54 { |
55 ASSERT(m_fontFace); | 55 ASSERT(m_fontFace); |
56 } | 56 } |
57 | 57 |
58 FontFace* fontFace() const { return m_fontFace; } | 58 FontFace* fontFace() const { return m_fontFace; } |
59 | 59 |
60 UnicodeRangeSet& ranges() { return m_ranges; } | 60 PassRefPtr<UnicodeRangeSet> ranges() { return m_ranges; } |
61 | 61 |
62 void setSegmentedFontFace(CSSSegmentedFontFace*); | 62 void setSegmentedFontFace(CSSSegmentedFontFace*); |
63 void clearSegmentedFontFace() { m_segmentedFontFace = nullptr; } | 63 void clearSegmentedFontFace() { m_segmentedFontFace = nullptr; } |
64 | 64 |
65 bool isValid() const { return !m_sources.isEmpty(); } | 65 bool isValid() const { return !m_sources.isEmpty(); } |
66 | 66 |
67 void addSource(PassOwnPtrWillBeRawPtr<CSSFontFaceSource>); | 67 void addSource(PassOwnPtrWillBeRawPtr<CSSFontFaceSource>); |
68 | 68 |
69 void didBeginLoad(); | 69 void didBeginLoad(); |
70 void fontLoaded(RemoteFontFaceSource*); | 70 void fontLoaded(RemoteFontFaceSource*); |
71 void didBecomeVisibleFallback(RemoteFontFaceSource*); | 71 void didBecomeVisibleFallback(RemoteFontFaceSource*); |
72 | 72 |
73 PassRefPtr<SimpleFontData> getFontData(const FontDescription&); | 73 PassRefPtr<SimpleFontData> getFontData(const FontDescription&); |
74 | 74 |
75 FontFace::LoadStatusType loadStatus() const { return m_fontFace->loadStatus(
); } | 75 FontFace::LoadStatusType loadStatus() const { return m_fontFace->loadStatus(
); } |
76 bool maybeScheduleFontLoad(const FontDescription&, UChar32); | 76 bool maybeScheduleFontLoad(const FontDescription&, UChar32); |
77 bool maybeScheduleFontLoad(const FontDescription&, const FontDataRange&); | 77 bool maybeScheduleFontLoad(const FontDescription&, const FontDataForRangeSet
&); |
78 void load(); | 78 void load(); |
79 void load(const FontDescription&); | 79 void load(const FontDescription&); |
80 | 80 |
81 bool hadBlankText() { return isValid() && m_sources.first()->hadBlankText();
} | 81 bool hadBlankText() { return isValid() && m_sources.first()->hadBlankText();
} |
82 | 82 |
83 DECLARE_TRACE(); | 83 DECLARE_TRACE(); |
84 | 84 |
85 private: | 85 private: |
86 void setLoadStatus(FontFace::LoadStatusType); | 86 void setLoadStatus(FontFace::LoadStatusType); |
87 | 87 |
88 UnicodeRangeSet m_ranges; | 88 RefPtr<UnicodeRangeSet> m_ranges; |
89 RawPtrWillBeMember<CSSSegmentedFontFace> m_segmentedFontFace; | 89 RawPtrWillBeMember<CSSSegmentedFontFace> m_segmentedFontFace; |
90 WillBeHeapDeque<OwnPtrWillBeMember<CSSFontFaceSource>> m_sources; | 90 WillBeHeapDeque<OwnPtrWillBeMember<CSSFontFaceSource>> m_sources; |
91 RawPtrWillBeMember<FontFace> m_fontFace; | 91 RawPtrWillBeMember<FontFace> m_fontFace; |
92 }; | 92 }; |
93 | 93 |
94 } // namespace blink | 94 } // namespace blink |
95 | 95 |
96 #endif | 96 #endif |
OLD | NEW |