Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 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/platform/graphics/FontTraitsMask.h" | 31 #include "core/platform/graphics/FontTraitsMask.h" |
| 32 #include "heap/Handle.h" | |
| 32 #include <wtf/Forward.h> | 33 #include <wtf/Forward.h> |
| 33 #include <wtf/HashSet.h> | 34 #include <wtf/HashSet.h> |
| 34 #include <wtf/PassRefPtr.h> | 35 #include <wtf/PassRefPtr.h> |
| 35 #include <wtf/RefCounted.h> | 36 #include <wtf/RefCounted.h> |
|
zerny-google
2013/07/02 14:24:04
Remove.
haraken
2013/07/02 14:31:30
Done.
| |
| 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 CSSSegmentedFontFace; |
| 42 class FontDescription; | 43 class FontDescription; |
| 43 class SimpleFontData; | 44 class SimpleFontData; |
| 44 | 45 |
| 45 class CSSFontFace : public RefCounted<CSSFontFace> { | 46 class CSSFontFace : public HeapAllocatedFinalized<CSSFontFace> { |
| 47 DECLARE_GC_TYPE_MARKER | |
| 46 public: | 48 public: |
| 47 static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask, Handle<CSSF ontFaceRule> rule, bool isLocalFallback = false) { return adoptRef(new CSSFontFa ce(traitsMask, rule, isLocalFallback)); } | 49 static Result<CSSFontFace> create(FontTraitsMask traitsMask, Handle<CSSFontF aceRule> rule, bool isLocalFallback = false) { return adopt(new CSSFontFace(trai tsMask, rule, isLocalFallback)); } |
| 48 | 50 |
| 49 FontTraitsMask traitsMask() const { return m_traitsMask; } | 51 FontTraitsMask traitsMask() const { return m_traitsMask; } |
| 50 | 52 |
| 51 struct UnicodeRange; | 53 struct UnicodeRange; |
| 52 | 54 |
| 53 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); } | 55 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); } |
| 54 const Vector<UnicodeRange>& ranges() const { return m_ranges; } | 56 const Vector<UnicodeRange>& ranges() const { return m_ranges; } |
| 55 | 57 |
| 56 void addedToSegmentedFontFace(CSSSegmentedFontFace*); | 58 void addedToSegmentedFontFace(Handle<CSSSegmentedFontFace>); |
| 57 void removedFromSegmentedFontFace(CSSSegmentedFontFace*); | 59 void removedFromSegmentedFontFace(Handle<CSSSegmentedFontFace>); |
| 58 | 60 |
| 59 bool isLoaded() const; | 61 bool isLoaded() const; |
| 60 bool isValid() const; | 62 bool isValid() const; |
| 61 | 63 |
| 62 bool isLocalFallback() const { return m_isLocalFallback; } | 64 bool isLocalFallback() const { return m_isLocalFallback; } |
| 63 | 65 |
| 64 void addSource(PassOwnPtr<CSSFontFaceSource>); | 66 void addSource(PassOwnPtr<CSSFontFaceSource>); |
| 65 | 67 |
| 66 void fontLoaded(CSSFontFaceSource*); | 68 void fontLoaded(CSSFontFaceSource*); |
| 67 | 69 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 82 UChar32 m_to; | 84 UChar32 m_to; |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #if ENABLE(SVG_FONTS) | 87 #if ENABLE(SVG_FONTS) |
| 86 bool hasSVGFontFaceSource() const; | 88 bool hasSVGFontFaceSource() const; |
| 87 #endif | 89 #endif |
| 88 | 90 |
| 89 enum LoadState { NotLoaded, Loading, Loaded, Error }; | 91 enum LoadState { NotLoaded, Loading, Loaded, Error }; |
| 90 LoadState loadState() const { return m_loadState; } | 92 LoadState loadState() const { return m_loadState; } |
| 91 | 93 |
| 94 void accept(Visitor*) const { } | |
|
zerny-google
2013/07/02 14:24:04
visit m_segmentedFontFaces and m_rule.
haraken
2013/07/02 14:31:30
This is a big mistake... Done.
| |
| 95 | |
| 92 private: | 96 private: |
| 93 CSSFontFace(FontTraitsMask traitsMask, Handle<CSSFontFaceRule> rule, bool is LocalFallback) | 97 CSSFontFace(FontTraitsMask traitsMask, Handle<CSSFontFaceRule> rule, bool is LocalFallback) |
| 94 : m_traitsMask(traitsMask) | 98 : m_traitsMask(traitsMask) |
| 95 , m_activeSource(0) | 99 , m_activeSource(0) |
| 96 , m_isLocalFallback(isLocalFallback) | 100 , m_isLocalFallback(isLocalFallback) |
| 97 , m_loadState(isLocalFallback ? Loaded : NotLoaded) | 101 , m_loadState(isLocalFallback ? Loaded : NotLoaded) |
| 98 , m_rule(rule) | 102 , m_rule(rule) |
| 99 { | 103 { |
| 100 UNUSED_PARAM(rule); | 104 UNUSED_PARAM(rule); |
| 101 } | 105 } |
| 102 | 106 |
| 103 FontTraitsMask m_traitsMask; | 107 FontTraitsMask m_traitsMask; |
| 104 Vector<UnicodeRange> m_ranges; | 108 Vector<UnicodeRange> m_ranges; |
| 105 HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces; | 109 HashSet<Member<CSSSegmentedFontFace> > m_segmentedFontFaces; |
| 106 Vector<OwnPtr<CSSFontFaceSource> > m_sources; | 110 Vector<OwnPtr<CSSFontFaceSource> > m_sources; |
| 107 CSSFontFaceSource* m_activeSource; | 111 CSSFontFaceSource* m_activeSource; |
| 108 bool m_isLocalFallback; | 112 bool m_isLocalFallback; |
| 109 LoadState m_loadState; | 113 LoadState m_loadState; |
| 110 Persistent<CSSFontFaceRule> m_rule; | 114 Member<CSSFontFaceRule> m_rule; |
| 111 void notifyFontLoader(LoadState); | 115 void notifyFontLoader(LoadState); |
| 112 }; | 116 }; |
| 113 | 117 |
| 114 } | 118 } |
| 115 | 119 |
| 116 #endif | 120 #endif |
| OLD | NEW |