Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: Source/core/css/CSSSegmentedFontFaceCache.cpp

Issue 82583005: Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Modified resetFontSelector Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698