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

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

Issue 157853002: Revert of Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/core/css/FontFaceCache.h ('k') | Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
117 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon tFace* second, FontTraitsMask desiredTraitsMask) 110 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon tFace* second, FontTraitsMask desiredTraitsMask)
118 { 111 {
119 FontTraitsMask firstTraitsMask = first->traitsMask(); 112 FontTraitsMask firstTraitsMask = first->traitsMask();
120 FontTraitsMask secondTraitsMask = second->traitsMask(); 113 FontTraitsMask secondTraitsMask = second->traitsMask();
121 114
122 bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVari antMask; 115 bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVari antMask;
123 bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVa riantMask; 116 bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVa riantMask;
124 117
125 if (firstHasDesiredVariant != secondHasDesiredVariant) 118 if (firstHasDesiredVariant != secondHasDesiredVariant)
126 return firstHasDesiredVariant; 119 return firstHasDesiredVariant;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask)) 209 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
217 continue; 210 continue;
218 if (!face || compareFontFaces(candidate, face.get(), traitsMask)) 211 if (!face || compareFontFaces(candidate, face.get(), traitsMask))
219 face = candidate; 212 face = candidate;
220 } 213 }
221 } 214 }
222 return face.get(); 215 return face.get();
223 } 216 }
224 217
225 } 218 }
OLDNEW
« no previous file with comments | « Source/core/css/FontFaceCache.h ('k') | Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698