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

Side by Side Diff: Source/core/platform/graphics/FontFallbackList.h

Issue 23446007: Use unicode-range to prevent unnecessary @font-face donwnloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 }; 66 };
67 67
68 static PassRefPtr<FontFallbackList> create() { return adoptRef(new FontFallb ackList()); } 68 static PassRefPtr<FontFallbackList> create() { return adoptRef(new FontFallb ackList()); }
69 69
70 ~FontFallbackList() { releaseFontData(); } 70 ~FontFallbackList() { releaseFontData(); }
71 void invalidate(PassRefPtr<FontSelector>); 71 void invalidate(PassRefPtr<FontSelector>);
72 72
73 bool isFixedPitch(const Font* f) const { if (m_pitch == UnknownPitch) determ inePitch(f); return m_pitch == FixedPitch; }; 73 bool isFixedPitch(const Font* f) const { if (m_pitch == UnknownPitch) determ inePitch(f); return m_pitch == FixedPitch; };
74 void determinePitch(const Font*) const; 74 void determinePitch(const Font*) const;
75 75
76 bool loadingCustomFonts() const { return m_loadingCustomFonts; } 76 bool loadingCustomFonts() const;
77 77
78 FontSelector* fontSelector() const { return m_fontSelector.get(); } 78 FontSelector* fontSelector() const { return m_fontSelector.get(); }
79 // FIXME: It should be possible to combine fontSelectorVersion and generatio n. 79 // FIXME: It should be possible to combine fontSelectorVersion and generatio n.
80 unsigned fontSelectorVersion() const { return m_fontSelectorVersion; } 80 unsigned fontSelectorVersion() const { return m_fontSelectorVersion; }
81 unsigned generation() const { return m_generation; } 81 unsigned generation() const { return m_generation; }
82 82
83 WidthCache& widthCache() const { return m_widthCache; } 83 WidthCache& widthCache() const { return m_widthCache; }
84 84
85 private: 85 private:
86 FontFallbackList(); 86 FontFallbackList();
87 87
88 const SimpleFontData* primarySimpleFontData(const Font* f) 88 const SimpleFontData* primarySimpleFontData(const Font* f)
89 { 89 {
90 ASSERT(isMainThread()); 90 ASSERT(isMainThread());
91 if (!m_cachedPrimarySimpleFontData) 91 if (!m_cachedPrimarySimpleFontData) {
92 m_cachedPrimarySimpleFontData = primaryFontData(f)->fontDataForChara cter(' '); 92 m_cachedPrimarySimpleFontData = primaryFontData(f)->fontDataForChara cter(' ');
93 if (m_cachedPrimarySimpleFontData)
94 m_cachedPrimarySimpleFontData->beginLoadIfNeeded();
95 }
93 return m_cachedPrimarySimpleFontData; 96 return m_cachedPrimarySimpleFontData;
94 } 97 }
95 98
96 const FontData* primaryFontData(const Font* f) const { return fontDataAt(f, 0); } 99 const FontData* primaryFontData(const Font* f) const { return fontDataAt(f, 0); }
97 const FontData* fontDataAt(const Font*, unsigned index) const; 100 const FontData* fontDataAt(const Font*, unsigned index) const;
98 101
99 void setPlatformFont(const FontPlatformData&); 102 void setPlatformFont(const FontPlatformData&);
100 103
101 void releaseFontData(); 104 void releaseFontData();
102 105
103 mutable Vector<RefPtr<FontData>, 1> m_fontList; 106 mutable Vector<RefPtr<FontData>, 1> m_fontList;
104 mutable GlyphPages m_pages; 107 mutable GlyphPages m_pages;
105 mutable GlyphPageTreeNode* m_pageZero; 108 mutable GlyphPageTreeNode* m_pageZero;
106 mutable const SimpleFontData* m_cachedPrimarySimpleFontData; 109 mutable const SimpleFontData* m_cachedPrimarySimpleFontData;
107 RefPtr<FontSelector> m_fontSelector; 110 RefPtr<FontSelector> m_fontSelector;
108 mutable WidthCache m_widthCache; 111 mutable WidthCache m_widthCache;
109 unsigned m_fontSelectorVersion; 112 unsigned m_fontSelectorVersion;
110 mutable int m_familyIndex; 113 mutable int m_familyIndex;
111 unsigned short m_generation; 114 unsigned short m_generation;
112 mutable unsigned m_pitch : 3; // Pitch 115 mutable unsigned m_pitch : 3; // Pitch
113 mutable bool m_loadingCustomFonts : 1; 116 mutable bool m_loadingCustomFonts : 1;
114 117
115 friend class Font; 118 friend class Font;
116 }; 119 };
117 120
118 } 121 }
119 122
120 #endif 123 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698