| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 if (m_segmentedFontFace) | 83 if (m_segmentedFontFace) |
| 84 m_segmentedFontFace->fontLoaded(this); | 84 m_segmentedFontFace->fontLoaded(this); |
| 85 } | 85 } |
| 86 | 86 |
| 87 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD
escription) | 87 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD
escription) |
| 88 { | 88 { |
| 89 if (!isValid()) | 89 if (!isValid()) |
| 90 return 0; | 90 return nullptr; |
| 91 | 91 |
| 92 while (!m_sources.isEmpty()) { | 92 while (!m_sources.isEmpty()) { |
| 93 OwnPtr<CSSFontFaceSource>& source = m_sources.first(); | 93 OwnPtr<CSSFontFaceSource>& source = m_sources.first(); |
| 94 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription)
) { | 94 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription)
) { |
| 95 if (loadStatus() == FontFace::Unloaded && (source->isLoading() || so
urce->isLoaded())) | 95 if (loadStatus() == FontFace::Unloaded && (source->isLoading() || so
urce->isLoaded())) |
| 96 setLoadStatus(FontFace::Loading); | 96 setLoadStatus(FontFace::Loading); |
| 97 if (loadStatus() == FontFace::Loading && source->isLoaded()) | 97 if (loadStatus() == FontFace::Loading && source->isLoaded()) |
| 98 setLoadStatus(FontFace::Loaded); | 98 setLoadStatus(FontFace::Loaded); |
| 99 return result.release(); | 99 return result.release(); |
| 100 } | 100 } |
| 101 m_sources.removeFirst(); | 101 m_sources.removeFirst(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (loadStatus() == FontFace::Unloaded) | 104 if (loadStatus() == FontFace::Unloaded) |
| 105 setLoadStatus(FontFace::Loading); | 105 setLoadStatus(FontFace::Loading); |
| 106 if (loadStatus() == FontFace::Loading) | 106 if (loadStatus() == FontFace::Loading) |
| 107 setLoadStatus(FontFace::Error); | 107 setLoadStatus(FontFace::Error); |
| 108 return 0; | 108 return nullptr; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void CSSFontFace::willUseFontData(const FontDescription& fontDescription) | 111 void CSSFontFace::willUseFontData(const FontDescription& fontDescription) |
| 112 { | 112 { |
| 113 // Kicks off font load here only if the @font-face has no unicode-range. | 113 // Kicks off font load here only if the @font-face has no unicode-range. |
| 114 // @font-faces with unicode-range will be loaded when a GlyphPage for the | 114 // @font-faces with unicode-range will be loaded when a GlyphPage for the |
| 115 // font is created. | 115 // font is created. |
| 116 // FIXME: Pass around the text to render from RenderText, and kick download | 116 // FIXME: Pass around the text to render from RenderText, and kick download |
| 117 // if m_ranges intersects with the text. Make sure this does not cause | 117 // if m_ranges intersects with the text. Make sure this does not cause |
| 118 // performance regression. | 118 // performance regression. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 UChar32 c = text.characterStartingAt(index); | 213 UChar32 c = text.characterStartingAt(index); |
| 214 index += U16_LENGTH(c); | 214 index += U16_LENGTH(c); |
| 215 Vector<UnicodeRange>::const_iterator it = std::lower_bound(m_ranges.begi
n(), m_ranges.end(), c); | 215 Vector<UnicodeRange>::const_iterator it = std::lower_bound(m_ranges.begi
n(), m_ranges.end(), c); |
| 216 if (it != m_ranges.end() && it->contains(c)) | 216 if (it != m_ranges.end() && it->contains(c)) |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 return false; | 219 return false; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } | 222 } |
| OLD | NEW |