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

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

Issue 1758383002: Revert of Use FontFallbackPriority Fonts in FontFallbackIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/FontDataRange.h"
9 #include "platform/fonts/FontFallbackPriority.h"
10 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
11 #include "wtf/PassRefPtr.h" 10 #include "wtf/PassRefPtr.h"
12 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h" 12 #include "wtf/RefPtr.h"
14 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
15 #include "wtf/text/Unicode.h" 14 #include "wtf/text/Unicode.h"
16 15
17 namespace blink { 16 namespace blink {
18 17
19 using namespace WTF; 18 using namespace WTF;
20 19
21 class FontDescription; 20 class FontDescription;
22 class FontFallbackList; 21 class FontFallbackList;
23 class SimpleFontData; 22 class SimpleFontData;
24 struct FontDataRange; 23 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);
33 31
34 // Returns whether a list of all remaining characters to be shaped is 32 // Returns whether a list of all remaining characters to be shaped is
35 // needed. Needed by the FontfallbackIterator in order to check whether a 33 // needed. Needed by the FontfallbackIterator in order to check whether a
36 // font from a segmented range should be loaded. 34 // font from a segmented range should be loaded.
37 bool needsHintList() const; 35 bool needsHintList() const;
38 36
39 bool hasNext() const { return m_fallbackStage != OutOfLuck; }; 37 bool hasNext() const { return m_fallbackStage != OutOfLuck; };
40 38
41 // Some system fallback APIs (Windows, Android) require a character, or a 39 // 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 40 // portion of the string to be passed. On Mac and Linux, we get a list of
43 // fonts without passing in characters. 41 // fonts without passing in characters.
44 const FontDataRange next(const Vector<UChar32>& hintList); 42 const FontDataRange next(const Vector<UChar32>& hintList);
45 43
46 private: 44 private:
47 FontFallbackIterator(const FontDescription&, PassRefPtr<FontFallbackList>, 45 FontFallbackIterator(const FontDescription&, PassRefPtr<FontFallbackList>);
48 FontFallbackPriority);
49 bool rangeContributesForHint(const Vector<UChar32> hintList, const FontDataR ange&); 46 bool rangeContributesForHint(const Vector<UChar32> hintList, const FontDataR ange&);
50 bool alreadyLoadingRangeForHintChar(UChar32 hintChar); 47 bool alreadyLoadingRangeForHintChar(UChar32 hintChar);
51 void willUseRange(const AtomicString& family, const FontDataRange&); 48 void willUseRange(const AtomicString& family, const FontDataRange&);
52 49
53 const PassRefPtr<SimpleFontData> fallbackPriorityFont(UChar32 hint);
54 const PassRefPtr<SimpleFontData> uniqueSystemFontForHint(UChar32 hint); 50 const PassRefPtr<SimpleFontData> uniqueSystemFontForHint(UChar32 hint);
55 51
56 const FontDescription& m_fontDescription; 52 const FontDescription& m_fontDescription;
57 RefPtr<FontFallbackList> m_fontFallbackList; 53 RefPtr<FontFallbackList> m_fontFallbackList;
58 int m_currentFontDataIndex; 54 int m_currentFontDataIndex;
59 unsigned m_segmentedIndex; 55 unsigned m_segmentedIndex;
60 56
61 enum FallbackStage { 57 enum FallbackStage {
62 FallbackPriorityFonts,
63 FontGroupFonts, 58 FontGroupFonts,
64 SegmentedFace, 59 SegmentedFace,
65 PreferencesFonts, 60 PreferencesFonts,
66 SystemFonts, 61 SystemFonts,
67 OutOfLuck 62 OutOfLuck
68 }; 63 };
69 64
70 FallbackStage m_fallbackStage; 65 FallbackStage m_fallbackStage;
71 HashMap<UChar32, RefPtr<SimpleFontData>> m_visitedSystemFonts; 66 HashMap<UChar32, RefPtr<SimpleFontData>> m_visitedSystemFonts;
72 Vector<FontDataRange> m_loadingCustomFontForRanges; 67 Vector<FontDataRange> m_loadingCustomFontForRanges;
73 FontFallbackPriority m_fontFallbackPriority;
74 }; 68 };
75 69
76 } // namespace blink 70 } // namespace blink
77 71
78 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698