OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/fonts/FontFallbackIterator.h" | 5 #include "platform/fonts/FontFallbackIterator.h" |
6 | 6 |
7 #include "platform/fonts/FontCache.h" | 7 #include "platform/fonts/FontCache.h" |
8 #include "platform/fonts/FontDescription.h" | 8 #include "platform/fonts/FontDescription.h" |
9 #include "platform/fonts/FontFallbackList.h" | 9 #include "platform/fonts/FontFallbackList.h" |
10 #include "platform/fonts/SegmentedFontData.h" | 10 #include "platform/fonts/SegmentedFontData.h" |
11 #include "platform/fonts/SimpleFontData.h" | 11 #include "platform/fonts/SimpleFontData.h" |
12 #include "platform/text/ICUError.h" | 12 #include "platform/text/ICUError.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 PassRefPtr<FontFallbackIterator> FontFallbackIterator::create( | 16 PassRefPtr<FontFallbackIterator> FontFallbackIterator::create( |
17 const FontDescription& description, | 17 const FontDescription& description, |
18 PassRefPtr<FontFallbackList> fallbackList, | 18 PassRefPtr<FontFallbackList> fallbackList, |
19 FontFallbackPriority fontFallbackPriority) { | 19 FontFallbackPriority fontFallbackPriority) { |
20 return adoptRef(new FontFallbackIterator(description, std::move(fallbackList), | 20 return adoptRef(new FontFallbackIterator(description, std::move(fallbackList), |
21 fontFallbackPriority)); | 21 fontFallbackPriority)); |
22 } | 22 } |
23 | 23 |
24 FontFallbackIterator::FontFallbackIterator( | 24 FontFallbackIterator::FontFallbackIterator( |
25 const FontDescription& description, | 25 const FontDescription& description, |
26 PassRefPtr<FontFallbackList> fallbackList, | 26 PassRefPtr<FontFallbackList> fallbackList, |
27 FontFallbackPriority fontFallbackPriority) | 27 FontFallbackPriority fontFallbackPriority) |
28 : m_fontDescription(description), | 28 : m_fontDescription(description), |
29 m_fontFallbackList(fallbackList), | 29 m_fontFallbackList(std::move(fallbackList)), |
30 m_currentFontDataIndex(0), | 30 m_currentFontDataIndex(0), |
31 m_segmentedFaceIndex(0), | 31 m_segmentedFaceIndex(0), |
32 m_fallbackStage(FontGroupFonts), | 32 m_fallbackStage(FontGroupFonts), |
33 m_fontFallbackPriority(fontFallbackPriority) {} | 33 m_fontFallbackPriority(fontFallbackPriority) {} |
34 | 34 |
35 bool FontFallbackIterator::alreadyLoadingRangeForHintChar(UChar32 hintChar) { | 35 bool FontFallbackIterator::alreadyLoadingRangeForHintChar(UChar32 hintChar) { |
36 for (auto it = m_trackedLoadingRangeSets.begin(); | 36 for (auto it = m_trackedLoadingRangeSets.begin(); |
37 it != m_trackedLoadingRangeSets.end(); ++it) { | 37 it != m_trackedLoadingRangeSets.end(); ++it) { |
38 if ((*it)->contains(hintChar)) | 38 if ((*it)->contains(hintChar)) |
39 return true; | 39 return true; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 if (!hint || m_previouslyAskedForHint.contains(hint)) | 236 if (!hint || m_previouslyAskedForHint.contains(hint)) |
237 return nullptr; | 237 return nullptr; |
238 m_previouslyAskedForHint.insert(hint); | 238 m_previouslyAskedForHint.insert(hint); |
239 return fontCache->fallbackFontForCharacter( | 239 return fontCache->fallbackFontForCharacter( |
240 m_fontDescription, hint, | 240 m_fontDescription, hint, |
241 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); | 241 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); |
242 } | 242 } |
243 | 243 |
244 } // namespace blink | 244 } // namespace blink |
OLD | NEW |