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