OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 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 class CSSFontFace; | 41 class CSSFontFace; |
42 class CSSFontFaceRule; | 42 class CSSFontFaceRule; |
43 class CSSFontSelectorClient; | 43 class CSSFontSelectorClient; |
44 class CSSSegmentedFontFace; | 44 class CSSSegmentedFontFace; |
45 class FontResource; | 45 class FontResource; |
46 class Document; | 46 class Document; |
47 class FontDescription; | 47 class FontDescription; |
48 class StyleRuleFontFace; | 48 class StyleRuleFontFace; |
49 | 49 |
50 class FontLoader { | 50 class FontLoader { |
| 51 DISALLOW_ALLOCATION(); |
51 public: | 52 public: |
52 explicit FontLoader(ResourceFetcher*); | 53 explicit FontLoader(ResourceFetcher*); |
53 | 54 |
54 void addFontToBeginLoading(FontResource*); | 55 void addFontToBeginLoading(FontResource*); |
55 void loadPendingFonts(); | 56 void loadPendingFonts(); |
56 | 57 |
57 void clearResourceFetcher(); | 58 void clearResourceFetcher(); |
58 | 59 |
| 60 void trace(Visitor*) { } |
| 61 |
59 private: | 62 private: |
60 void beginLoadTimerFired(Timer<FontLoader>*); | 63 void beginLoadTimerFired(Timer<FontLoader>*); |
61 | 64 |
62 Timer<FontLoader> m_beginLoadingTimer; | 65 Timer<FontLoader> m_beginLoadingTimer; |
63 Vector<ResourcePtr<FontResource> > m_fontsToBeginLoading; | 66 Vector<ResourcePtr<FontResource> > m_fontsToBeginLoading; |
64 ResourceFetcher* m_resourceFetcher; | 67 ResourceFetcher* m_resourceFetcher; |
65 }; | 68 }; |
66 | 69 |
67 class CSSFontSelector FINAL : public FontSelector { | 70 class CSSFontSelector FINAL : public FontSelector { |
68 public: | 71 public: |
69 static PassRefPtr<CSSFontSelector> create(Document* document) | 72 static PassRefPtrWillBeRawPtr<CSSFontSelector> create(Document* document) |
70 { | 73 { |
71 return adoptRef(new CSSFontSelector(document)); | 74 return adoptRefWillBeNoop(new CSSFontSelector(document)); |
72 } | 75 } |
73 virtual ~CSSFontSelector(); | 76 virtual ~CSSFontSelector(); |
74 | 77 |
75 virtual unsigned version() const OVERRIDE { return m_fontFaceCache.version()
; } | 78 virtual unsigned version() const OVERRIDE { return m_fontFaceCache.version()
; } |
76 | 79 |
77 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi
cString&) OVERRIDE; | 80 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi
cString&) OVERRIDE; |
78 virtual void willUseFontData(const FontDescription&, const AtomicString& fam
ily) OVERRIDE; | 81 virtual void willUseFontData(const FontDescription&, const AtomicString& fam
ily) OVERRIDE; |
79 | 82 |
80 void clearDocument(); | 83 void clearDocument(); |
81 | 84 |
82 void fontLoaded(); | 85 void fontLoaded(); |
83 | 86 |
84 // FontCacheClient implementation | 87 // FontCacheClient implementation |
85 virtual void fontCacheInvalidated() OVERRIDE; | 88 virtual void fontCacheInvalidated() OVERRIDE; |
86 | 89 |
87 void registerForInvalidationCallbacks(CSSFontSelectorClient*); | 90 void registerForInvalidationCallbacks(CSSFontSelectorClient*); |
88 #if !ENABLE(OILPAN) | 91 #if !ENABLE(OILPAN) |
89 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); | 92 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); |
90 #endif | 93 #endif |
91 | 94 |
92 Document* document() const { return m_document; } | 95 Document* document() const { return m_document; } |
93 FontFaceCache* fontFaceCache() { return &m_fontFaceCache; } | 96 FontFaceCache* fontFaceCache() { return &m_fontFaceCache; } |
94 | 97 |
95 const GenericFontFamilySettings& genericFontFamilySettings() const { return
m_genericFontFamilySettings; } | 98 const GenericFontFamilySettings& genericFontFamilySettings() const { return
m_genericFontFamilySettings; } |
96 void updateGenericFontFamilySettings(Document&); | 99 void updateGenericFontFamilySettings(Document&); |
97 | 100 |
98 void beginLoadingFontSoon(FontResource*); | 101 void beginLoadingFontSoon(FontResource*); |
99 void loadPendingFonts(); | 102 void loadPendingFonts(); |
100 | 103 |
| 104 virtual void trace(Visitor*); |
| 105 |
101 private: | 106 private: |
102 explicit CSSFontSelector(Document*); | 107 explicit CSSFontSelector(Document*); |
103 | 108 |
104 void dispatchInvalidationCallbacks(); | 109 void dispatchInvalidationCallbacks(); |
105 | 110 |
106 Document* m_document; | 111 Document* m_document; |
107 // FIXME: Move to Document or StyleEngine. | 112 // FIXME: Move to Document or StyleEngine. |
108 FontFaceCache m_fontFaceCache; | 113 FontFaceCache m_fontFaceCache; |
109 WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<CSSFontSelectorClient> >
m_clients; | 114 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSFontSelectorClient> > m_clients; |
110 | 115 |
111 FontLoader m_fontLoader; | 116 FontLoader m_fontLoader; |
112 GenericFontFamilySettings m_genericFontFamilySettings; | 117 GenericFontFamilySettings m_genericFontFamilySettings; |
113 }; | 118 }; |
114 | 119 |
115 } // namespace WebCore | 120 } // namespace WebCore |
116 | 121 |
117 #endif // CSSFontSelector_h | 122 #endif // CSSFontSelector_h |
OLD | NEW |