1180 int RenderStyle::computedLineHeight(RenderView* renderView) const
1181 {
1182 const Length& lh = lineHeight();
1183
1184
1185 if (lh.isNegative())
1186 return fontMetrics().lineSpacing(); <=====
1187
1188 if (lh.isPercent())
1189 return minimumValueForLength(lh, fontSize());
1190
1191 if (lh.isViewportPercentage())
1192 return valueForLength(lh, 0, renderView);
1193
1194 return lh.value();
1195 }
1146 const FontMetrics& RenderStyle::fontMetrics() const {
return inherited->font.fontMetrics();
}
135 const FontMetrics& fontMetrics() const {
return primaryFont()->fontMetrics();
}
301 inline const SimpleFontData* Font::primaryFont() const
302 {
303 ASSERT(m_fontFallbackList);
304 return m_fontFallbackList->primarySimpleFontData(this);
305 }
88 const SimpleFontData* primarySimpleFontData(const Font* f)
89 {
90 ASSERT(isMainThread());
91 if (!m_cachedPrimarySimpleFontData) <===== 下の関数を読んでいるのでNULL
92 m_cachedPrimarySimpleFontData = primaryFontData(f)->fontDataForCharacter(' '); <=====
93 return m_cachedPrimarySimpleFontData;
94 }
91 const FontData* FontFallbackList::primaryFontData(const Font* f) const
92 {
93 for (unsigned fontIndex = 0; ; ++fontIndex) {
94 const FontData* fontData = fontDataAt(f, fontIndex); <=====
95 if (!fontData) {
96
97 FIXME
98 return fontDataAt(f, 0);
99 }
100
101
102
103 if (!fontData->isLoading())
104 return fontData;
105 }
106 }
108 const FontData* FontFallbackList::fontDataAt(const Font* font, unsigned realizedFontIndex) const
109 {
110 if (realizedFontIndex < m_fontList.size())
111 return m_fontList[realizedFontIndex].get();
112
113
114 ASSERT(realizedFontIndex == m_fontList.size());
115
116 if (m_familyIndex == cAllFamiliesScanned)
117 return 0;
118
119
120
121
122
123 ASSERT(fontCache()->generation() == m_generation);
124 RefPtr<FontData> result = fontCache()->getFontData(*font, m_familyIndex, m_fontSelector.get()); <=====
125 if (result) {
126 m_fontList.append(result);
127 if (result->isLoading())
128 m_loadingCustomFonts = true;
129 }
130 return result.get();
131 }
132
457 PassRefPtr<FontData> FontCache::getFontData(const Font& font, int& familyIndex, FontSelector* fontSelector)
458 {
459 RefPtr<FontData> result;
460
461 int startIndex = familyIndex;
462 const FontFamily* startFamily = &font.fontDescription().family();
463 for (int i = 0; startFamily && i < startIndex; i++)
464 startFamily = startFamily->next();
465 const FontFamily* currFamily = startFamily;
466 while (currFamily && !result) {
467 familyIndex++;
468 if (currFamily->family().length()) {
469 if (fontSelector)
470 result = fontSelector->getFontData(font.fontDescription(), currFamily->family());
471
472 if (!result)
473 result = getFontResourceData(font.fontDescription(), currFamily->family());
474 }
475 currFamily = currFamily->next();
476 }
477
478 if (!currFamily)
479 familyIndex = cAllFamiliesScanned;
480
481 if (!result)
482
483
484
485 result = getSimilarFontPlatformData(font);
486
487 if (!result && startIndex == 0) {
488
489
490
491 if (fontSelector) {
492
493 if (RefPtr<FontData> data = fontSelector->getFontData(font.fontDescription(), standardFamily))
494 return data.release();
495 }
496
497
498 result = getLastResortFallbackFont(font.fontDescription());
499 }
500 return result.release();
501 }
303 PassRefPtr<SimpleFontData> FontCache::getFontResourceData(const FontPlatformData* platformData, ShouldRetain shouldRetain)
304 {
305 if (!platformData)
306 return 0;
307
308 #if !ASSERT_DISABLED
309 if (shouldRetain == DoNotRetain)
310 ASSERT(m_purgePreventCount);
311 #endif
312
313 if (!gFontDataCache) {
314 gFontDataCache = new FontDataCache;
315 gInactiveFontData = new ListHashSet<RefPtr<SimpleFontData> >;
316 }
317
318 FontDataCache::iterator result = gFontDataCache->find(*platformData);
319 if (result == gFontDataCache->end()) {
320 pair<RefPtr<SimpleFontData>, unsigned> newValue(SimpleFontData::create(*platformData), shouldRetain == Retain ? 1 : 0);
321 gFontDataCache->set(*platformData, newValue);
322 if (shouldRetain == DoNotRetain)
323 gInactiveFontData->add(newValue.first);
324 return newValue.first.release();
325 }
326
327 if (!result.get()->value.second) {
328 ASSERT(gInactiveFontData->contains(result.get()->value.first));
329 gInactiveFontData->remove(result.get()->value.first);
330 }
331
332 if (shouldRetain == Retain)
333 result.get()->value.second++;
334 else if (!result.get()->value.second) {
335
336
337 gInactiveFontData->add(result.get()->value.first);
338 }
339
340 return result.get()->value.first;
341 }