| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 document->fonts()->fontLoaded(m_fontFace.get()); | 170 document->fonts()->fontLoaded(m_fontFace.get()); |
| 171 break; | 171 break; |
| 172 case FontFace::Error: | 172 case FontFace::Error: |
| 173 document->fonts()->loadError(m_fontFace.get()); | 173 document->fonts()->loadError(m_fontFace.get()); |
| 174 break; | 174 break; |
| 175 default: | 175 default: |
| 176 break; | 176 break; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 #if ENABLE(SVG_FONTS) | |
| 181 bool CSSFontFace::hasSVGFontFaceSource() const | |
| 182 { | |
| 183 size_t size = m_sources.size(); | |
| 184 for (size_t i = 0; i < size; i++) { | |
| 185 if (m_sources[i]->isSVGFontFaceSource()) | |
| 186 return true; | |
| 187 } | |
| 188 return false; | |
| 189 } | |
| 190 #endif | |
| 191 | |
| 192 bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const | 180 bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const |
| 193 { | 181 { |
| 194 if (text.isEmpty()) | 182 if (text.isEmpty()) |
| 195 return false; | 183 return false; |
| 196 if (m_ranges.isEmpty()) | 184 if (m_ranges.isEmpty()) |
| 197 return true; // Empty UnicodeRangeSet represents the whole code space. | 185 return true; // Empty UnicodeRangeSet represents the whole code space. |
| 198 | 186 |
| 199 // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be | 187 // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be |
| 200 // better to make m_ranges sorted and use binary search. | 188 // better to make m_ranges sorted and use binary search. |
| 201 unsigned index = 0; | 189 unsigned index = 0; |
| 202 while (index < text.length()) { | 190 while (index < text.length()) { |
| 203 UChar32 c = text.characterStartingAt(index); | 191 UChar32 c = text.characterStartingAt(index); |
| 204 index += U16_LENGTH(c); | 192 index += U16_LENGTH(c); |
| 205 for (unsigned i = 0; i < m_ranges.size(); i++) { | 193 for (unsigned i = 0; i < m_ranges.size(); i++) { |
| 206 if (m_ranges[i].contains(c)) | 194 if (m_ranges[i].contains(c)) |
| 207 return true; | 195 return true; |
| 208 } | 196 } |
| 209 } | 197 } |
| 210 return false; | 198 return false; |
| 211 } | 199 } |
| 212 | 200 |
| 213 } | 201 } |
| OLD | NEW |