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 * | 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 m_fontFace->setLoadStatus(newStatus); | 154 m_fontFace->setLoadStatus(newStatus); |
155 | 155 |
156 if (!m_segmentedFontFace) | 156 if (!m_segmentedFontFace) |
157 return; | 157 return; |
158 Document* document = m_segmentedFontFace->fontSelector()->document(); | 158 Document* document = m_segmentedFontFace->fontSelector()->document(); |
159 if (!document) | 159 if (!document) |
160 return; | 160 return; |
161 | 161 |
162 switch (newStatus) { | 162 switch (newStatus) { |
163 case FontFace::Loading: | 163 case FontFace::Loading: |
164 FontFaceSet::from(document)->beginFontLoading(m_fontFace); | 164 FontFaceSet::from(*document)->beginFontLoading(m_fontFace); |
165 break; | 165 break; |
166 case FontFace::Loaded: | 166 case FontFace::Loaded: |
167 FontFaceSet::from(document)->fontLoaded(m_fontFace); | 167 FontFaceSet::from(*document)->fontLoaded(m_fontFace); |
168 break; | 168 break; |
169 case FontFace::Error: | 169 case FontFace::Error: |
170 FontFaceSet::from(document)->loadError(m_fontFace); | 170 FontFaceSet::from(*document)->loadError(m_fontFace); |
171 break; | 171 break; |
172 default: | 172 default: |
173 break; | 173 break; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const | 177 bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const |
178 { | 178 { |
179 if (text.isEmpty()) | 179 if (text.isEmpty()) |
180 return false; | 180 return false; |
181 if (isEntireRange()) | 181 if (isEntireRange()) |
182 return true; | 182 return true; |
183 | 183 |
184 // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be | 184 // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be |
185 // better to make m_ranges sorted and use binary search. | 185 // better to make m_ranges sorted and use binary search. |
186 unsigned index = 0; | 186 unsigned index = 0; |
187 while (index < text.length()) { | 187 while (index < text.length()) { |
188 UChar32 c = text.characterStartingAt(index); | 188 UChar32 c = text.characterStartingAt(index); |
189 index += U16_LENGTH(c); | 189 index += U16_LENGTH(c); |
190 for (unsigned i = 0; i < m_ranges.size(); i++) { | 190 for (unsigned i = 0; i < m_ranges.size(); i++) { |
191 if (m_ranges[i].contains(c)) | 191 if (m_ranges[i].contains(c)) |
192 return true; | 192 return true; |
193 } | 193 } |
194 } | 194 } |
195 return false; | 195 return false; |
196 } | 196 } |
197 | 197 |
198 } | 198 } |
OLD | NEW |