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 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 m_fonts.clear(); | 103 m_fonts.clear(); |
104 if (cssConnected) | 104 if (cssConnected) |
105 m_cssConnectedFontFaces.remove(fontFace); | 105 m_cssConnectedFontFaces.remove(fontFace); |
106 | 106 |
107 ++m_version; | 107 ++m_version; |
108 } | 108 } |
109 | 109 |
110 void FontFaceCache::clearCSSConnected() | 110 void FontFaceCache::clearCSSConnected() |
111 { | 111 { |
112 for (StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.begin(); it !=
m_styleRuleToFontFace.end(); ++it) | 112 for (const auto& item : m_styleRuleToFontFace) |
113 removeFontFace(it->value.get(), true); | 113 removeFontFace(item.value.get(), true); |
114 m_styleRuleToFontFace.clear(); | 114 m_styleRuleToFontFace.clear(); |
115 } | 115 } |
116 | 116 |
117 void FontFaceCache::clearAll() | 117 void FontFaceCache::clearAll() |
118 { | 118 { |
119 if (m_fontFaces.isEmpty()) | 119 if (m_fontFaces.isEmpty()) |
120 return; | 120 return; |
121 | 121 |
122 m_fontFaces.clear(); | 122 m_fontFaces.clear(); |
123 m_fonts.clear(); | 123 m_fonts.clear(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!familyFontFaces || familyFontFaces->isEmpty()) | 205 if (!familyFontFaces || familyFontFaces->isEmpty()) |
206 return 0; | 206 return 0; |
207 | 207 |
208 FamilyToTraitsMap::AddResult traitsResult = m_fonts.add(family, nullptr); | 208 FamilyToTraitsMap::AddResult traitsResult = m_fonts.add(family, nullptr); |
209 if (!traitsResult.storedValue->value) | 209 if (!traitsResult.storedValue->value) |
210 traitsResult.storedValue->value = adoptPtrWillBeNoop(new TraitsMap); | 210 traitsResult.storedValue->value = adoptPtrWillBeNoop(new TraitsMap); |
211 | 211 |
212 FontTraits traits = fontDescription.traits(); | 212 FontTraits traits = fontDescription.traits(); |
213 TraitsMap::AddResult faceResult = traitsResult.storedValue->value->add(trait
s.bitfield(), nullptr); | 213 TraitsMap::AddResult faceResult = traitsResult.storedValue->value->add(trait
s.bitfield(), nullptr); |
214 if (!faceResult.storedValue->value) { | 214 if (!faceResult.storedValue->value) { |
215 for (TraitsMap::const_iterator i = familyFontFaces->begin(); i != family
FontFaces->end(); ++i) { | 215 for (const auto& item : *familyFontFaces) { |
216 CSSSegmentedFontFace* candidate = i->value.get(); | 216 CSSSegmentedFontFace* candidate = item.value.get(); |
217 FontTraits candidateTraits = candidate->traits(); | 217 FontTraits candidateTraits = candidate->traits(); |
218 if (traits.style() == FontStyleNormal && candidateTraits.style() !=
FontStyleNormal) | 218 if (traits.style() == FontStyleNormal && candidateTraits.style() !=
FontStyleNormal) |
219 continue; | 219 continue; |
220 if (traits.variant() == FontVariantNormal && candidateTraits.variant
() != FontVariantNormal) | 220 if (traits.variant() == FontVariantNormal && candidateTraits.variant
() != FontVariantNormal) |
221 continue; | 221 continue; |
222 if (!faceResult.storedValue->value || compareFontFaces(candidate, fa
ceResult.storedValue->value.get(), traits)) | 222 if (!faceResult.storedValue->value || compareFontFaces(candidate, fa
ceResult.storedValue->value.get(), traits)) |
223 faceResult.storedValue->value = candidate; | 223 faceResult.storedValue->value = candidate; |
224 } | 224 } |
225 } | 225 } |
226 return faceResult.storedValue->value.get(); | 226 return faceResult.storedValue->value.get(); |
227 } | 227 } |
228 | 228 |
229 void FontFaceCache::trace(Visitor* visitor) | 229 void FontFaceCache::trace(Visitor* visitor) |
230 { | 230 { |
231 #if ENABLE(OILPAN) | 231 #if ENABLE(OILPAN) |
232 visitor->trace(m_fontFaces); | 232 visitor->trace(m_fontFaces); |
233 visitor->trace(m_fonts); | 233 visitor->trace(m_fonts); |
234 visitor->trace(m_styleRuleToFontFace); | 234 visitor->trace(m_styleRuleToFontFace); |
235 visitor->trace(m_cssConnectedFontFaces); | 235 visitor->trace(m_cssConnectedFontFaces); |
236 #endif | 236 #endif |
237 } | 237 } |
238 | 238 |
239 } | 239 } |
OLD | NEW |