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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (familyFontFaces->isEmpty()) | 100 if (familyFontFaces->isEmpty()) |
101 m_fontFaces.remove(fontFacesIter); | 101 m_fontFaces.remove(fontFacesIter); |
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::clear() |
| 111 { |
| 112 for (StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.begin(); it !=
m_styleRuleToFontFace.end(); ++it) |
| 113 removeFontFace(it->value.get(), true); |
| 114 m_styleRuleToFontFace.clear(); |
| 115 } |
| 116 |
110 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon
tFace* second, FontTraitsMask desiredTraitsMask) | 117 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon
tFace* second, FontTraitsMask desiredTraitsMask) |
111 { | 118 { |
112 FontTraitsMask firstTraitsMask = first->traitsMask(); | 119 FontTraitsMask firstTraitsMask = first->traitsMask(); |
113 FontTraitsMask secondTraitsMask = second->traitsMask(); | 120 FontTraitsMask secondTraitsMask = second->traitsMask(); |
114 | 121 |
115 bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVari
antMask; | 122 bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVari
antMask; |
116 bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVa
riantMask; | 123 bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVa
riantMask; |
117 | 124 |
118 if (firstHasDesiredVariant != secondHasDesiredVariant) | 125 if (firstHasDesiredVariant != secondHasDesiredVariant) |
119 return firstHasDesiredVariant; | 126 return firstHasDesiredVariant; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask &
FontVariantNormalMask)) | 216 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask &
FontVariantNormalMask)) |
210 continue; | 217 continue; |
211 if (!face || compareFontFaces(candidate, face.get(), traitsMask)) | 218 if (!face || compareFontFaces(candidate, face.get(), traitsMask)) |
212 face = candidate; | 219 face = candidate; |
213 } | 220 } |
214 } | 221 } |
215 return face.get(); | 222 return face.get(); |
216 } | 223 } |
217 | 224 |
218 } | 225 } |
OLD | NEW |