OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void fontLoaded(CSSFontFace*); | 57 void fontLoaded(CSSFontFace*); |
58 void fontLoadWaitLimitExceeded(CSSFontFace*); | 58 void fontLoadWaitLimitExceeded(CSSFontFace*); |
59 | 59 |
60 void addFontFace(PassRefPtr<FontFace>, bool cssConnected); | 60 void addFontFace(PassRefPtr<FontFace>, bool cssConnected); |
61 void removeFontFace(PassRefPtr<FontFace>); | 61 void removeFontFace(PassRefPtr<FontFace>); |
62 bool isEmpty() const { return m_fontFaces.isEmpty(); } | 62 bool isEmpty() const { return m_fontFaces.isEmpty(); } |
63 | 63 |
64 PassRefPtr<FontData> getFontData(const FontDescription&); | 64 PassRefPtr<FontData> getFontData(const FontDescription&); |
65 | 65 |
66 class LoadFontCallback : public RefCounted<LoadFontCallback> { | |
67 public: | |
68 virtual ~LoadFontCallback() { } | |
69 virtual void notifyLoaded(CSSSegmentedFontFace*) = 0; | |
70 virtual void notifyError(CSSSegmentedFontFace*) = 0; | |
71 }; | |
72 | |
73 bool checkFont(const String&) const; | 66 bool checkFont(const String&) const; |
74 void loadFont(const FontDescription&, const String&, PassRefPtr<LoadFontCall
back>); | 67 void match(const String&, Vector<RefPtr<FontFace> >&) const; |
75 void willUseFontData(const FontDescription&); | 68 void willUseFontData(const FontDescription&); |
76 | 69 |
77 private: | 70 private: |
78 CSSSegmentedFontFace(CSSFontSelector*, FontTraits); | 71 CSSSegmentedFontFace(CSSFontSelector*, FontTraits); |
79 | 72 |
80 void pruneTable(); | 73 void pruneTable(); |
81 bool isValid() const; | 74 bool isValid() const; |
82 bool isLoading() const; | 75 bool isLoading() const; |
83 bool isLoaded() const; | 76 bool isLoaded() const; |
84 | 77 |
85 typedef ListHashSet<RefPtr<FontFace> > FontFaceList; | 78 typedef ListHashSet<RefPtr<FontFace> > FontFaceList; |
86 | 79 |
87 CSSFontSelector* m_fontSelector; | 80 CSSFontSelector* m_fontSelector; |
88 FontTraits m_traits; | 81 FontTraits m_traits; |
89 HashMap<unsigned, RefPtr<SegmentedFontData> > m_fontDataTable; | 82 HashMap<unsigned, RefPtr<SegmentedFontData> > m_fontDataTable; |
90 // All non-CSS-connected FontFaces are stored after the CSS-connected ones. | 83 // All non-CSS-connected FontFaces are stored after the CSS-connected ones. |
91 FontFaceList m_fontFaces; | 84 FontFaceList m_fontFaces; |
92 FontFaceList::iterator m_firstNonCssConnectedFace; | 85 FontFaceList::iterator m_firstNonCssConnectedFace; |
93 Vector<RefPtr<LoadFontCallback> > m_callbacks; | |
94 }; | 86 }; |
95 | 87 |
96 } // namespace WebCore | 88 } // namespace WebCore |
97 | 89 |
98 #endif // CSSSegmentedFontFace_h | 90 #endif // CSSSegmentedFontFace_h |
OLD | NEW |