Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontFallbackIterator.h

Issue 1806653002: Shape unicode-range: font faces in only one iteration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update UnicodeRangeSetTests to RefPtrtr, rm copy constructor and test Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef FontFallbackIterator_h 5 #ifndef FontFallbackIterator_h
6 #define FontFallbackIterator_h 6 #define FontFallbackIterator_h
7 7
8 #include "platform/fonts/FontDataRange.h" 8 #include "platform/fonts/FontDataForRangeSet.h"
9 #include "platform/fonts/FontFallbackPriority.h" 9 #include "platform/fonts/FontFallbackPriority.h"
10 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
11 #include "wtf/PassRefPtr.h" 11 #include "wtf/PassRefPtr.h"
12 #include "wtf/RefCounted.h" 12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
15 #include "wtf/text/Unicode.h" 15 #include "wtf/text/Unicode.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 using namespace WTF; 19 using namespace WTF;
20 20
21 class FontDescription; 21 class FontDescription;
22 class FontFallbackList; 22 class FontFallbackList;
23 class SimpleFontData; 23 class SimpleFontData;
24 struct FontDataRange;
25 class FontFamily; 24 class FontFamily;
26 25
27 class FontFallbackIterator : public RefCounted<FontFallbackIterator> { 26 class FontFallbackIterator : public RefCounted<FontFallbackIterator> {
28 WTF_MAKE_NONCOPYABLE(FontFallbackIterator); 27 WTF_MAKE_NONCOPYABLE(FontFallbackIterator);
29 28
30 public: 29 public:
31 static PassRefPtr<FontFallbackIterator> create(const FontDescription&, PassR efPtr<FontFallbackList>, 30 static PassRefPtr<FontFallbackIterator> create(const FontDescription&, PassR efPtr<FontFallbackList>,
32 FontFallbackPriority); 31 FontFallbackPriority);
33 32
34 // Returns whether a list of all remaining characters to be shaped is 33 // Returns whether a list of all remaining characters to be shaped is
35 // needed. Needed by the FontfallbackIterator in order to check whether a 34 // needed. Needed by the FontfallbackIterator in order to check whether a
36 // font from a segmented range should be loaded. 35 // font from a segmented range should be loaded.
37 bool needsHintList() const; 36 bool needsHintList() const;
38 37
39 bool hasNext() const { return m_fallbackStage != OutOfLuck; }; 38 bool hasNext() const { return m_fallbackStage != OutOfLuck; };
40 39
41 // Some system fallback APIs (Windows, Android) require a character, or a 40 // Some system fallback APIs (Windows, Android) require a character, or a
42 // portion of the string to be passed. On Mac and Linux, we get a list of 41 // portion of the string to be passed. On Mac and Linux, we get a list of
43 // fonts without passing in characters. 42 // fonts without passing in characters.
44 const FontDataRange next(const Vector<UChar32>& hintList); 43 const FontDataForRangeSet next(const Vector<UChar32>& hintList);
45 44
46 private: 45 private:
47 FontFallbackIterator(const FontDescription&, PassRefPtr<FontFallbackList>, 46 FontFallbackIterator(const FontDescription&, PassRefPtr<FontFallbackList>,
48 FontFallbackPriority); 47 FontFallbackPriority);
49 bool rangeContributesForHint(const Vector<UChar32> hintList, const FontDataR ange&); 48 bool rangeSetContributesForHint(const Vector<UChar32> hintList, const FontDa taForRangeSet&);
50 bool alreadyLoadingRangeForHintChar(UChar32 hintChar); 49 bool alreadyLoadingRangeForHintChar(UChar32 hintChar);
51 void willUseRange(const AtomicString& family, const FontDataRange&); 50 void willUseRange(const AtomicString& family, const FontDataForRangeSet&);
52 51
53 const PassRefPtr<SimpleFontData> fallbackPriorityFont(UChar32 hint); 52 const PassRefPtr<SimpleFontData> fallbackPriorityFont(UChar32 hint);
54 const PassRefPtr<SimpleFontData> uniqueSystemFontForHint(UChar32 hint); 53 const PassRefPtr<SimpleFontData> uniqueSystemFontForHint(UChar32 hint);
55 54
56 const FontDescription& m_fontDescription; 55 const FontDescription& m_fontDescription;
57 RefPtr<FontFallbackList> m_fontFallbackList; 56 RefPtr<FontFallbackList> m_fontFallbackList;
58 int m_currentFontDataIndex; 57 int m_currentFontDataIndex;
59 unsigned m_segmentedIndex; 58 unsigned m_segmentedFaceIndex;
60 59
61 enum FallbackStage { 60 enum FallbackStage {
62 FallbackPriorityFonts, 61 FallbackPriorityFonts,
63 FontGroupFonts, 62 FontGroupFonts,
64 SegmentedFace, 63 SegmentedFace,
65 PreferencesFonts, 64 PreferencesFonts,
66 SystemFonts, 65 SystemFonts,
67 OutOfLuck 66 OutOfLuck
68 }; 67 };
69 68
70 FallbackStage m_fallbackStage; 69 FallbackStage m_fallbackStage;
71 HashMap<UChar32, RefPtr<SimpleFontData>> m_visitedSystemFonts; 70 HashMap<UChar32, RefPtr<SimpleFontData>> m_visitedSystemFonts;
72 Vector<FontDataRange> m_loadingCustomFontForRanges; 71 Vector<FontDataForRangeSet> m_trackedLoadingRangeSets;
73 FontFallbackPriority m_fontFallbackPriority; 72 FontFallbackPriority m_fontFallbackPriority;
74 }; 73 };
75 74
76 } // namespace blink 75 } // namespace blink
77 76
78 #endif 77 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698