| 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 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CSSFontFace_h | 26 #ifndef CSSFontFace_h |
| 27 #define CSSFontFace_h | 27 #define CSSFontFace_h |
| 28 | 28 |
| 29 #include "core/css/CSSFontFaceRule.h" | 29 #include "core/css/CSSFontFaceRule.h" |
| 30 #include "core/css/CSSFontFaceSource.h" | 30 #include "core/css/CSSFontFaceSource.h" |
| 31 #include "core/css/CSSSegmentedFontFace.h" |
| 31 #include "core/platform/graphics/FontTraitsMask.h" | 32 #include "core/platform/graphics/FontTraitsMask.h" |
| 33 #include "heap/Handle.h" |
| 32 #include <wtf/Forward.h> | 34 #include <wtf/Forward.h> |
| 33 #include <wtf/HashSet.h> | 35 #include <wtf/HashSet.h> |
| 34 #include <wtf/PassRefPtr.h> | 36 #include <wtf/PassRefPtr.h> |
| 35 #include <wtf/RefCounted.h> | |
| 36 #include <wtf/unicode/Unicode.h> | 37 #include <wtf/unicode/Unicode.h> |
| 37 #include <wtf/Vector.h> | 38 #include <wtf/Vector.h> |
| 38 | 39 |
| 39 namespace WebCore { | 40 namespace WebCore { |
| 40 | 41 |
| 41 class CSSSegmentedFontFace; | |
| 42 class FontDescription; | 42 class FontDescription; |
| 43 class SimpleFontData; | 43 class SimpleFontData; |
| 44 | 44 |
| 45 class CSSFontFace : public RefCounted<CSSFontFace> { | 45 class CSSFontFace : public HeapAllocatedFinalized<CSSFontFace> { |
| 46 DECLARE_GC_TYPE_MARKER |
| 46 public: | 47 public: |
| 47 static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask, Handle<CSSF
ontFaceRule> rule, bool isLocalFallback = false) { return adoptRef(new CSSFontFa
ce(traitsMask, rule, isLocalFallback)); } | 48 static Result<CSSFontFace> create(FontTraitsMask traitsMask, Handle<CSSFontF
aceRule> rule, bool isLocalFallback = false) { return adopt(new CSSFontFace(trai
tsMask, rule, isLocalFallback)); } |
| 48 | 49 |
| 49 FontTraitsMask traitsMask() const { return m_traitsMask; } | 50 FontTraitsMask traitsMask() const { return m_traitsMask; } |
| 50 | 51 |
| 51 struct UnicodeRange; | 52 struct UnicodeRange; |
| 52 | 53 |
| 53 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from,
to)); } | 54 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from,
to)); } |
| 54 const Vector<UnicodeRange>& ranges() const { return m_ranges; } | 55 const Vector<UnicodeRange>& ranges() const { return m_ranges; } |
| 55 | 56 |
| 56 void addedToSegmentedFontFace(Handle<CSSSegmentedFontFace>); | 57 void addedToSegmentedFontFace(Handle<CSSSegmentedFontFace>); |
| 57 void removedFromSegmentedFontFace(Handle<CSSSegmentedFontFace>); | |
| 58 | 58 |
| 59 bool isLoaded() const; | 59 bool isLoaded() const; |
| 60 bool isValid() const; | 60 bool isValid() const; |
| 61 | 61 |
| 62 bool isLocalFallback() const { return m_isLocalFallback; } | 62 bool isLocalFallback() const { return m_isLocalFallback; } |
| 63 | 63 |
| 64 void addSource(PassOwnPtr<CSSFontFaceSource>); | 64 void addSource(PassOwnPtr<CSSFontFaceSource>); |
| 65 | 65 |
| 66 void fontLoaded(CSSFontFaceSource*); | 66 void fontLoaded(CSSFontFaceSource*); |
| 67 | 67 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 82 UChar32 m_to; | 82 UChar32 m_to; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 #if ENABLE(SVG_FONTS) | 85 #if ENABLE(SVG_FONTS) |
| 86 bool hasSVGFontFaceSource() const; | 86 bool hasSVGFontFaceSource() const; |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 enum LoadState { NotLoaded, Loading, Loaded, Error }; | 89 enum LoadState { NotLoaded, Loading, Loaded, Error }; |
| 90 LoadState loadState() const { return m_loadState; } | 90 LoadState loadState() const { return m_loadState; } |
| 91 | 91 |
| 92 void accept(Visitor*) const; |
| 93 void dispose(); |
| 94 |
| 92 private: | 95 private: |
| 93 CSSFontFace(FontTraitsMask traitsMask, Handle<CSSFontFaceRule> rule, bool is
LocalFallback) | 96 CSSFontFace(FontTraitsMask traitsMask, Handle<CSSFontFaceRule> rule, bool is
LocalFallback) |
| 94 : m_traitsMask(traitsMask) | 97 : m_traitsMask(traitsMask) |
| 95 , m_activeSource(0) | 98 , m_activeSource(0) |
| 96 , m_isLocalFallback(isLocalFallback) | 99 , m_isLocalFallback(isLocalFallback) |
| 97 , m_loadState(isLocalFallback ? Loaded : NotLoaded) | 100 , m_loadState(isLocalFallback ? Loaded : NotLoaded) |
| 98 , m_rule(rule) | 101 , m_rule(rule) |
| 99 { | 102 { |
| 100 UNUSED_PARAM(rule); | 103 UNUSED_PARAM(rule); |
| 101 } | 104 } |
| 102 | 105 |
| 103 FontTraitsMask m_traitsMask; | 106 FontTraitsMask m_traitsMask; |
| 104 Vector<UnicodeRange> m_ranges; | 107 Vector<UnicodeRange> m_ranges; |
| 105 HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces; | 108 HashSet<Member<CSSSegmentedFontFace> > m_segmentedFontFaces; |
| 106 Vector<OwnPtr<CSSFontFaceSource> > m_sources; | 109 Vector<OwnPtr<CSSFontFaceSource> > m_sources; |
| 107 CSSFontFaceSource* m_activeSource; | 110 CSSFontFaceSource* m_activeSource; |
| 108 bool m_isLocalFallback; | 111 bool m_isLocalFallback; |
| 109 LoadState m_loadState; | 112 LoadState m_loadState; |
| 110 Persistent<CSSFontFaceRule> m_rule; | 113 Member<CSSFontFaceRule> m_rule; |
| 111 void notifyFontLoader(LoadState); | 114 void notifyFontLoader(LoadState); |
| 112 }; | 115 }; |
| 113 | 116 |
| 114 } | 117 } |
| 115 | 118 |
| 116 #endif | 119 #endif |
| OLD | NEW |