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

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

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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 else { 81 else {
82 const SegmentedFontData* segmentedFontData = static_cast<const Segmented FontData*>(fontData); 82 const SegmentedFontData* segmentedFontData = static_cast<const Segmented FontData*>(fontData);
83 unsigned numRanges = segmentedFontData->numRanges(); 83 unsigned numRanges = segmentedFontData->numRanges();
84 if (numRanges == 1) 84 if (numRanges == 1)
85 m_pitch = segmentedFontData->rangeAt(0).fontData()->pitch(); 85 m_pitch = segmentedFontData->rangeAt(0).fontData()->pitch();
86 else 86 else
87 m_pitch = VariablePitch; 87 m_pitch = VariablePitch;
88 } 88 }
89 } 89 }
90 90
91 bool FontFallbackList::loadingCustomFonts() const
92 {
93 if (m_loadingCustomFonts)
94 return true;
95
96 unsigned numFonts = m_fontList.size();
97 for (unsigned i = 0; i < numFonts; ++i) {
98 if (m_fontList[i]->isCustomFont() && m_fontList[i]->isLoading()) {
99 m_loadingCustomFonts = true;
dglazkov 2013/09/10 15:26:41 This smells wrong. Why does a const getter modify
Kunihiko Sakamoto 2013/09/11 13:28:09 Now FontData in m_fontList can change its loading
100 return true;
101 }
102 }
103 return false;
104 }
105
91 const FontData* FontFallbackList::fontDataAt(const Font* font, unsigned realized FontIndex) const 106 const FontData* FontFallbackList::fontDataAt(const Font* font, unsigned realized FontIndex) const
92 { 107 {
93 if (realizedFontIndex < m_fontList.size()) 108 if (realizedFontIndex < m_fontList.size())
94 return m_fontList[realizedFontIndex].get(); // This fallback font is alr eady in our list. 109 return m_fontList[realizedFontIndex].get(); // This fallback font is alr eady in our list.
95 110
96 // Make sure we're not passing in some crazy value here. 111 // Make sure we're not passing in some crazy value here.
97 ASSERT(realizedFontIndex == m_fontList.size()); 112 ASSERT(realizedFontIndex == m_fontList.size());
98 113
99 if (m_familyIndex == cAllFamiliesScanned) 114 if (m_familyIndex == cAllFamiliesScanned)
100 return 0; 115 return 0;
(...skipping 14 matching lines...) Expand all
115 130
116 void FontFallbackList::setPlatformFont(const FontPlatformData& platformData) 131 void FontFallbackList::setPlatformFont(const FontPlatformData& platformData)
117 { 132 {
118 m_familyIndex = cAllFamiliesScanned; 133 m_familyIndex = cAllFamiliesScanned;
119 ASSERT(fontCache()->generation() == m_generation); 134 ASSERT(fontCache()->generation() == m_generation);
120 RefPtr<FontData> fontData = fontCache()->getFontResourceData(&platformData); 135 RefPtr<FontData> fontData = fontCache()->getFontResourceData(&platformData);
121 m_fontList.append(fontData); 136 m_fontList.append(fontData);
122 } 137 }
123 138
124 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698