| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 if (loadStatus() == FontFace::Loading) { | 60 if (loadStatus() == FontFace::Loading) { |
| 61 if (source->isValid()) { | 61 if (source->isValid()) { |
| 62 setLoadStatus(FontFace::Loaded); | 62 setLoadStatus(FontFace::Loaded); |
| 63 } else if (source->getDisplayPeriod() == | 63 } else if (source->getDisplayPeriod() == |
| 64 RemoteFontFaceSource::FailurePeriod) { | 64 RemoteFontFaceSource::FailurePeriod) { |
| 65 m_sources.clear(); | 65 m_sources.clear(); |
| 66 setLoadStatus(FontFace::Error); | 66 setLoadStatus(FontFace::Error); |
| 67 } else { | 67 } else { |
| 68 m_sources.removeFirst(); | 68 m_sources.pop_front(); |
| 69 load(); | 69 load(); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (m_segmentedFontFace) | 73 if (m_segmentedFontFace) |
| 74 m_segmentedFontFace->fontFaceInvalidated(); | 74 m_segmentedFontFace->fontFaceInvalidated(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 size_t CSSFontFace::approximateBlankCharacterCount() const { | 77 size_t CSSFontFace::approximateBlankCharacterCount() const { |
| 78 if (!m_sources.isEmpty() && m_sources.first()->isBlank() && | 78 if (!m_sources.isEmpty() && m_sources.first()->isBlank() && |
| (...skipping 17 matching lines...) Expand all Loading... |
| 96 while (!m_sources.isEmpty()) { | 96 while (!m_sources.isEmpty()) { |
| 97 Member<CSSFontFaceSource>& source = m_sources.first(); | 97 Member<CSSFontFaceSource>& source = m_sources.first(); |
| 98 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription)) { | 98 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription)) { |
| 99 if (loadStatus() == FontFace::Unloaded && | 99 if (loadStatus() == FontFace::Unloaded && |
| 100 (source->isLoading() || source->isLoaded())) | 100 (source->isLoading() || source->isLoaded())) |
| 101 setLoadStatus(FontFace::Loading); | 101 setLoadStatus(FontFace::Loading); |
| 102 if (loadStatus() == FontFace::Loading && source->isLoaded()) | 102 if (loadStatus() == FontFace::Loading && source->isLoaded()) |
| 103 setLoadStatus(FontFace::Loaded); | 103 setLoadStatus(FontFace::Loaded); |
| 104 return result.release(); | 104 return result.release(); |
| 105 } | 105 } |
| 106 m_sources.removeFirst(); | 106 m_sources.pop_front(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 if (loadStatus() == FontFace::Unloaded) | 109 if (loadStatus() == FontFace::Unloaded) |
| 110 setLoadStatus(FontFace::Loading); | 110 setLoadStatus(FontFace::Loading); |
| 111 if (loadStatus() == FontFace::Loading) | 111 if (loadStatus() == FontFace::Loading) |
| 112 setLoadStatus(FontFace::Error); | 112 setLoadStatus(FontFace::Error); |
| 113 return nullptr; | 113 return nullptr; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool CSSFontFace::maybeLoadFont(const FontDescription& fontDescription, | 116 bool CSSFontFace::maybeLoadFont(const FontDescription& fontDescription, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 } else { | 164 } else { |
| 165 if (!source->isLoaded()) | 165 if (!source->isLoaded()) |
| 166 source->beginLoadIfNeeded(); | 166 source->beginLoadIfNeeded(); |
| 167 else | 167 else |
| 168 setLoadStatus(FontFace::Loaded); | 168 setLoadStatus(FontFace::Loaded); |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 m_sources.removeFirst(); | 172 m_sources.pop_front(); |
| 173 } | 173 } |
| 174 setLoadStatus(FontFace::Error); | 174 setLoadStatus(FontFace::Error); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void CSSFontFace::setLoadStatus(FontFace::LoadStatusType newStatus) { | 177 void CSSFontFace::setLoadStatus(FontFace::LoadStatusType newStatus) { |
| 178 ASSERT(m_fontFace); | 178 ASSERT(m_fontFace); |
| 179 if (newStatus == FontFace::Error) | 179 if (newStatus == FontFace::Error) |
| 180 m_fontFace->setError(); | 180 m_fontFace->setError(); |
| 181 else | 181 else |
| 182 m_fontFace->setLoadStatus(newStatus); | 182 m_fontFace->setLoadStatus(newStatus); |
| 183 | 183 |
| 184 if (!m_segmentedFontFace) | 184 if (!m_segmentedFontFace) |
| 185 return; | 185 return; |
| 186 Document* document = m_segmentedFontFace->fontSelector()->document(); | 186 Document* document = m_segmentedFontFace->fontSelector()->document(); |
| 187 if (document && newStatus == FontFace::Loading) | 187 if (document && newStatus == FontFace::Loading) |
| 188 FontFaceSet::from(*document)->beginFontLoading(m_fontFace); | 188 FontFaceSet::from(*document)->beginFontLoading(m_fontFace); |
| 189 } | 189 } |
| 190 | 190 |
| 191 DEFINE_TRACE(CSSFontFace) { | 191 DEFINE_TRACE(CSSFontFace) { |
| 192 visitor->trace(m_segmentedFontFace); | 192 visitor->trace(m_segmentedFontFace); |
| 193 visitor->trace(m_sources); | 193 visitor->trace(m_sources); |
| 194 visitor->trace(m_fontFace); | 194 visitor->trace(m_fontFace); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |