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 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void CSSFontSelector::fontLoaded() | 146 void CSSFontSelector::fontLoaded() |
147 { | 147 { |
148 dispatchInvalidationCallbacks(); | 148 dispatchInvalidationCallbacks(); |
149 } | 149 } |
150 | 150 |
151 void CSSFontSelector::fontCacheInvalidated() | 151 void CSSFontSelector::fontCacheInvalidated() |
152 { | 152 { |
153 dispatchInvalidationCallbacks(); | 153 dispatchInvalidationCallbacks(); |
154 } | 154 } |
155 | 155 |
156 void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule) | 156 void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule, Pas
sRefPtr<CSSFontFace> cssFontFace) |
157 { | 157 { |
158 m_cssSegmentedFontFaceCache.addFontFaceRule(this, fontFaceRule); | 158 m_cssSegmentedFontFaceCache.add(this, fontFaceRule, cssFontFace); |
159 } | 159 } |
160 | 160 |
161 void CSSFontSelector::removeFontFaceRule(const StyleRuleFontFace* fontFaceRule) | 161 void CSSFontSelector::removeFontFaceRule(const StyleRuleFontFace* fontFaceRule) |
162 { | 162 { |
163 m_cssSegmentedFontFaceCache.removeFontFaceRule(fontFaceRule); | 163 m_cssSegmentedFontFaceCache.remove(fontFaceRule); |
164 } | 164 } |
165 | 165 |
166 static AtomicString familyNameFromSettings(const GenericFontFamilySettings& sett
ings, const FontDescription& fontDescription, const AtomicString& genericFamilyN
ame) | 166 static AtomicString familyNameFromSettings(const GenericFontFamilySettings& sett
ings, const FontDescription& fontDescription, const AtomicString& genericFamilyN
ame) |
167 { | 167 { |
168 UScriptCode script = fontDescription.script(); | 168 UScriptCode script = fontDescription.script(); |
169 | 169 |
170 if (fontDescription.genericFamily() == FontDescription::StandardFamily && !f
ontDescription.isSpecifiedFont()) | 170 if (fontDescription.genericFamily() == FontDescription::StandardFamily && !f
ontDescription.isSpecifiedFont()) |
171 return settings.standard(script); | 171 return settings.standard(script); |
172 | 172 |
173 #if OS(ANDROID) | 173 #if OS(ANDROID) |
(...skipping 12 matching lines...) Expand all Loading... |
186 if (genericFamilyName == FontFamilyNames::webkit_pictograph) | 186 if (genericFamilyName == FontFamilyNames::webkit_pictograph) |
187 return settings.pictograph(script); | 187 return settings.pictograph(script); |
188 if (genericFamilyName == FontFamilyNames::webkit_standard) | 188 if (genericFamilyName == FontFamilyNames::webkit_standard) |
189 return settings.standard(script); | 189 return settings.standard(script); |
190 #endif | 190 #endif |
191 return emptyAtom; | 191 return emptyAtom; |
192 } | 192 } |
193 | 193 |
194 PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDes
cription, const AtomicString& familyName) | 194 PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDes
cription, const AtomicString& familyName) |
195 { | 195 { |
196 if (CSSSegmentedFontFace* face = m_cssSegmentedFontFaceCache.getFontFace(fon
tDescription, familyName)) | 196 if (CSSSegmentedFontFace* face = m_cssSegmentedFontFaceCache.get(fontDescrip
tion, familyName)) |
197 return face->getFontData(fontDescription); | 197 return face->getFontData(fontDescription); |
198 | 198 |
199 // Try to return the correct font based off our settings, in case we were ha
nded the generic font family name. | 199 // Try to return the correct font based off our settings, in case we were ha
nded the generic font family name. |
200 AtomicString settingsFamilyName = familyNameFromSettings(m_genericFontFamily
Settings, fontDescription, familyName); | 200 AtomicString settingsFamilyName = familyNameFromSettings(m_genericFontFamily
Settings, fontDescription, familyName); |
201 if (settingsFamilyName.isEmpty()) | 201 if (settingsFamilyName.isEmpty()) |
202 return 0; | 202 return 0; |
203 | 203 |
204 return fontCache()->getFontResourceData(fontDescription, settingsFamilyName)
; | 204 return fontCache()->getFontResourceData(fontDescription, settingsFamilyName)
; |
205 } | 205 } |
206 | 206 |
207 CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDe
scription, const AtomicString& familyName) | 207 CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDe
scription, const AtomicString& familyName) |
208 { | 208 { |
209 return m_cssSegmentedFontFaceCache.getFontFace(fontDescription, familyName); | 209 return m_cssSegmentedFontFaceCache.get(fontDescription, familyName); |
210 } | 210 } |
211 | 211 |
212 void CSSFontSelector::willUseFontData(const FontDescription& fontDescription, co
nst AtomicString& family) | 212 void CSSFontSelector::willUseFontData(const FontDescription& fontDescription, co
nst AtomicString& family) |
213 { | 213 { |
214 CSSSegmentedFontFace* face = getFontFace(fontDescription, family); | 214 CSSSegmentedFontFace* face = getFontFace(fontDescription, family); |
215 if (face) | 215 if (face) |
216 face->willUseFontData(fontDescription); | 216 face->willUseFontData(fontDescription); |
217 } | 217 } |
218 | 218 |
219 void CSSFontSelector::clearDocument() | 219 void CSSFontSelector::clearDocument() |
220 { | 220 { |
221 m_fontLoader.clearResourceFetcher(); | 221 m_fontLoader.clearResourceFetcher(); |
222 m_document = 0; | 222 m_document = 0; |
223 } | 223 } |
224 | 224 |
225 void CSSFontSelector::beginLoadingFontSoon(FontResource* font) | 225 void CSSFontSelector::beginLoadingFontSoon(FontResource* font) |
226 { | 226 { |
227 m_fontLoader.addFontToBeginLoading(font); | 227 m_fontLoader.addFontToBeginLoading(font); |
228 } | 228 } |
229 | 229 |
230 void CSSFontSelector::loadPendingFonts() | 230 void CSSFontSelector::loadPendingFonts() |
231 { | 231 { |
232 m_fontLoader.loadPendingFonts(); | 232 m_fontLoader.loadPendingFonts(); |
233 } | 233 } |
234 | 234 |
235 } | 235 } |
OLD | NEW |