| 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 12 matching lines...) Expand all Loading... |
| 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 SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ | 26 #ifndef SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ |
| 27 #define SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ | 27 #define SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ |
| 28 | 28 |
| 29 #include "sky/engine/core/css/FontFaceCache.h" | 29 #include "sky/engine/core/css/FontFaceCache.h" |
| 30 #include "sky/engine/core/css/FontLoader.h" | 30 #include "sky/engine/core/css/FontLoader.h" |
| 31 #include "sky/engine/platform/fonts/FontSelector.h" | 31 #include "sky/engine/platform/fonts/FontSelector.h" |
| 32 #include "sky/engine/platform/fonts/GenericFontFamilySettings.h" | 32 #include "sky/engine/platform/fonts/GenericFontFamilySettings.h" |
| 33 #include "sky/engine/platform/heap/Handle.h" | |
| 34 #include "sky/engine/wtf/Forward.h" | 33 #include "sky/engine/wtf/Forward.h" |
| 35 #include "sky/engine/wtf/HashMap.h" | 34 #include "sky/engine/wtf/HashMap.h" |
| 36 #include "sky/engine/wtf/HashSet.h" | 35 #include "sky/engine/wtf/HashSet.h" |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 class CSSFontFace; | 39 class CSSFontFace; |
| 41 class CSSFontFaceRule; | 40 class CSSFontFaceRule; |
| 42 class CSSFontSelectorClient; | 41 class CSSFontSelectorClient; |
| 43 class CSSSegmentedFontFace; | 42 class CSSSegmentedFontFace; |
| 44 class Document; | 43 class Document; |
| 45 class FontDescription; | 44 class FontDescription; |
| 46 class StyleRuleFontFace; | 45 class StyleRuleFontFace; |
| 47 | 46 |
| 48 class CSSFontSelector final : public FontSelector { | 47 class CSSFontSelector final : public FontSelector { |
| 49 public: | 48 public: |
| 50 static PassRefPtr<CSSFontSelector> create(Document* document) | 49 static PassRefPtr<CSSFontSelector> create(Document* document) |
| 51 { | 50 { |
| 52 return adoptRef(new CSSFontSelector(document)); | 51 return adoptRef(new CSSFontSelector(document)); |
| 53 } | 52 } |
| 54 virtual ~CSSFontSelector(); | 53 virtual ~CSSFontSelector(); |
| 55 | 54 |
| 56 virtual unsigned version() const override { return m_fontFaceCache.version()
; } | 55 virtual unsigned version() const override { return m_fontFaceCache.version()
; } |
| 57 | 56 |
| 58 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi
cString&) override; | 57 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi
cString&) override; |
| 59 virtual void willUseFontData(const FontDescription&, const AtomicString& fam
ily, UChar32) override; | 58 virtual void willUseFontData(const FontDescription&, const AtomicString& fam
ily, UChar32) override; |
| 60 bool isPlatformFontAvailable(const FontDescription&, const AtomicString& fam
ily); | 59 bool isPlatformFontAvailable(const FontDescription&, const AtomicString& fam
ily); |
| 61 | 60 |
| 62 #if !ENABLE(OILPAN) | |
| 63 void clearDocument(); | 61 void clearDocument(); |
| 64 #endif | |
| 65 | 62 |
| 66 void fontFaceInvalidated(); | 63 void fontFaceInvalidated(); |
| 67 | 64 |
| 68 // FontCacheClient implementation | 65 // FontCacheClient implementation |
| 69 virtual void fontCacheInvalidated() override; | 66 virtual void fontCacheInvalidated() override; |
| 70 | 67 |
| 71 void registerForInvalidationCallbacks(CSSFontSelectorClient*); | 68 void registerForInvalidationCallbacks(CSSFontSelectorClient*); |
| 72 #if !ENABLE(OILPAN) | |
| 73 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); | 69 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); |
| 74 #endif | |
| 75 | 70 |
| 76 Document* document() const { return m_document; } | 71 Document* document() const { return m_document; } |
| 77 FontFaceCache* fontFaceCache() { return &m_fontFaceCache; } | 72 FontFaceCache* fontFaceCache() { return &m_fontFaceCache; } |
| 78 FontLoader* fontLoader() { return m_fontLoader.get(); } | 73 FontLoader* fontLoader() { return m_fontLoader.get(); } |
| 79 | 74 |
| 80 const GenericFontFamilySettings& genericFontFamilySettings() const { return
m_genericFontFamilySettings; } | 75 const GenericFontFamilySettings& genericFontFamilySettings() const { return
m_genericFontFamilySettings; } |
| 81 void updateGenericFontFamilySettings(Document&); | 76 void updateGenericFontFamilySettings(Document&); |
| 82 | 77 |
| 83 private: | 78 private: |
| 84 explicit CSSFontSelector(Document*); | 79 explicit CSSFontSelector(Document*); |
| 85 | 80 |
| 86 void dispatchInvalidationCallbacks(); | 81 void dispatchInvalidationCallbacks(); |
| 87 | 82 |
| 88 // FIXME: Oilpan: Ideally this should just be a traced Member but that will | 83 // FIXME: Oilpan: Ideally this should just be a traced Member but that will |
| 89 // currently leak because RenderStyle and its data are not on the heap. | 84 // currently leak because RenderStyle and its data are not on the heap. |
| 90 // See crbug.com/383860 for details. | 85 // See crbug.com/383860 for details. |
| 91 RawPtr<Document> m_document; | 86 RawPtr<Document> m_document; |
| 92 // FIXME: Move to Document or StyleEngine. | 87 // FIXME: Move to Document or StyleEngine. |
| 93 FontFaceCache m_fontFaceCache; | 88 FontFaceCache m_fontFaceCache; |
| 94 HashSet<RawPtr<CSSFontSelectorClient> > m_clients; | 89 HashSet<RawPtr<CSSFontSelectorClient> > m_clients; |
| 95 | 90 |
| 96 RefPtr<FontLoader> m_fontLoader; | 91 RefPtr<FontLoader> m_fontLoader; |
| 97 GenericFontFamilySettings m_genericFontFamilySettings; | 92 GenericFontFamilySettings m_genericFontFamilySettings; |
| 98 }; | 93 }; |
| 99 | 94 |
| 100 } // namespace blink | 95 } // namespace blink |
| 101 | 96 |
| 102 #endif // SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ | 97 #endif // SKY_ENGINE_CORE_CSS_CSSFONTSELECTOR_H_ |
| OLD | NEW |