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

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

Issue 645743003: Use C++11 range-based loop for core/css (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: better variable names Created 6 years, 2 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/CSSGridTemplateAreasValue.cpp ('k') | Source/core/css/ElementRuleCollector.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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 : m_fontSelector(fontSelector) 41 : m_fontSelector(fontSelector)
42 , m_traits(traits) 42 , m_traits(traits)
43 , m_firstNonCssConnectedFace(m_fontFaces.end()) 43 , m_firstNonCssConnectedFace(m_fontFaces.end())
44 { 44 {
45 } 45 }
46 46
47 CSSSegmentedFontFace::~CSSSegmentedFontFace() 47 CSSSegmentedFontFace::~CSSSegmentedFontFace()
48 { 48 {
49 pruneTable(); 49 pruneTable();
50 #if !ENABLE(OILPAN) 50 #if !ENABLE(OILPAN)
51 for (FontFaceList::iterator it = m_fontFaces.begin(); it != m_fontFaces.end( ); ++it) 51 for (const auto& fontFace : m_fontFaces)
52 (*it)->cssFontFace()->clearSegmentedFontFace(); 52 fontFace->cssFontFace()->clearSegmentedFontFace();
53 #endif 53 #endif
54 } 54 }
55 55
56 void CSSSegmentedFontFace::pruneTable() 56 void CSSSegmentedFontFace::pruneTable()
57 { 57 {
58 // Make sure the glyph page tree prunes out all uses of this custom font. 58 // Make sure the glyph page tree prunes out all uses of this custom font.
59 if (m_fontDataTable.isEmpty()) 59 if (m_fontDataTable.isEmpty())
60 return; 60 return;
61 61
62 m_fontDataTable.clear(); 62 m_fontDataTable.clear();
63 } 63 }
64 64
65 bool CSSSegmentedFontFace::isValid() const 65 bool CSSSegmentedFontFace::isValid() const
66 { 66 {
67 // Valid if at least one font face is valid. 67 // Valid if at least one font face is valid.
68 for (FontFaceList::const_iterator it = m_fontFaces.begin(); it != m_fontFace s.end(); ++it) { 68 for (const auto& fontFace : m_fontFaces) {
69 if ((*it)->cssFontFace()->isValid()) 69 if (fontFace->cssFontFace()->isValid())
70 return true; 70 return true;
71 } 71 }
72 return false; 72 return false;
73 } 73 }
74 74
75 void CSSSegmentedFontFace::fontLoaded(CSSFontFace*) 75 void CSSSegmentedFontFace::fontLoaded(CSSFontFace*)
76 { 76 {
77 pruneTable(); 77 pruneTable();
78 } 78 }
79 79
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 } 161 }
162 if (fontData->numRanges()) 162 if (fontData->numRanges())
163 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has. 163 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
164 164
165 return nullptr; 165 return nullptr;
166 } 166 }
167 167
168 bool CSSSegmentedFontFace::isLoading() const 168 bool CSSSegmentedFontFace::isLoading() const
169 { 169 {
170 for (FontFaceList::const_iterator it = m_fontFaces.begin(); it != m_fontFace s.end(); ++it) { 170 for (const auto& fontFace : m_fontFaces) {
171 if ((*it)->loadStatus() == FontFace::Loading) 171 if (fontFace->loadStatus() == FontFace::Loading)
172 return true; 172 return true;
173 } 173 }
174 return false; 174 return false;
175 } 175 }
176 176
177 bool CSSSegmentedFontFace::isLoaded() const 177 bool CSSSegmentedFontFace::isLoaded() const
178 { 178 {
179 for (FontFaceList::const_iterator it = m_fontFaces.begin(); it != m_fontFace s.end(); ++it) { 179 for (const auto& fontFace : m_fontFaces) {
180 if ((*it)->loadStatus() != FontFace::Loaded) 180 if (fontFace->loadStatus() != FontFace::Loaded)
181 return false; 181 return false;
182 } 182 }
183 return true; 183 return true;
184 } 184 }
185 185
186 void CSSSegmentedFontFace::willUseFontData(const FontDescription& fontDescriptio n, UChar32 character) 186 void CSSSegmentedFontFace::willUseFontData(const FontDescription& fontDescriptio n, UChar32 character)
187 { 187 {
188 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin(); it != m_fontF aces.rend(); ++it) { 188 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin(); it != m_fontF aces.rend(); ++it) {
189 if ((*it)->loadStatus() != FontFace::Unloaded) 189 if ((*it)->loadStatus() != FontFace::Unloaded)
190 break; 190 break;
191 if ((*it)->cssFontFace()->maybeScheduleFontLoad(fontDescription, charact er)) 191 if ((*it)->cssFontFace()->maybeScheduleFontLoad(fontDescription, charact er))
192 break; 192 break;
193 } 193 }
194 } 194 }
195 195
196 bool CSSSegmentedFontFace::checkFont(const String& text) const 196 bool CSSSegmentedFontFace::checkFont(const String& text) const
197 { 197 {
198 for (FontFaceList::const_iterator it = m_fontFaces.begin(); it != m_fontFace s.end(); ++it) { 198 for (const auto& fontFace : m_fontFaces) {
199 if ((*it)->loadStatus() != FontFace::Loaded && (*it)->cssFontFace()->ran ges().intersectsWith(text)) 199 if (fontFace->loadStatus() != FontFace::Loaded && fontFace->cssFontFace( )->ranges().intersectsWith(text))
200 return false; 200 return false;
201 } 201 }
202 return true; 202 return true;
203 } 203 }
204 204
205 void CSSSegmentedFontFace::match(const String& text, WillBeHeapVector<RefPtrWill BeMember<FontFace> >& faces) const 205 void CSSSegmentedFontFace::match(const String& text, WillBeHeapVector<RefPtrWill BeMember<FontFace> >& faces) const
206 { 206 {
207 for (FontFaceList::const_iterator it = m_fontFaces.begin(); it != m_fontFace s.end(); ++it) { 207 for (const auto& fontFace : m_fontFaces) {
208 if ((*it)->cssFontFace()->ranges().intersectsWith(text)) 208 if (fontFace->cssFontFace()->ranges().intersectsWith(text))
209 faces.append(*it); 209 faces.append(fontFace);
210 } 210 }
211 } 211 }
212 212
213 void CSSSegmentedFontFace::trace(Visitor* visitor) 213 void CSSSegmentedFontFace::trace(Visitor* visitor)
214 { 214 {
215 #if ENABLE(OILPAN) 215 #if ENABLE(OILPAN)
216 visitor->trace(m_fontSelector); 216 visitor->trace(m_fontSelector);
217 visitor->trace(m_fontFaces); 217 visitor->trace(m_fontFaces);
218 #endif 218 #endif
219 } 219 }
220 220
221 } 221 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSGridTemplateAreasValue.cpp ('k') | Source/core/css/ElementRuleCollector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698