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