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

Unified Diff: Source/platform/fonts/shaping/CachingWordShapeIterator.h

Issue 1241613006: Reland "Change fallback font collection in HarfBuzzShaper" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | Source/platform/fonts/shaping/CachingWordShaper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/shaping/CachingWordShapeIterator.h
diff --git a/Source/platform/fonts/shaping/CachingWordShapeIterator.h b/Source/platform/fonts/shaping/CachingWordShapeIterator.h
index e004766e5a721191ff7c02ed99683d620eb8d260..526c7e397483827ef471c7de46bed6ec12342215 100644
--- a/Source/platform/fonts/shaping/CachingWordShapeIterator.h
+++ b/Source/platform/fonts/shaping/CachingWordShapeIterator.h
@@ -36,10 +36,9 @@ namespace blink {
class CachingWordShapeIterator {
public:
- CachingWordShapeIterator(ShapeCache* cache, const TextRun& run,
- const Font* font, HashSet<const SimpleFontData*>* fallbackFonts)
- : m_shapeCache(cache), m_textRun(run), m_font(font)
- , m_fallbackFonts(fallbackFonts), m_startIndex(0)
+ CachingWordShapeIterator(ShapeCache* cache, const TextRun& run
+ , const Font* font)
+ : m_shapeCache(cache), m_textRun(run), m_font(font), m_startIndex(0)
{
ASSERT(font);
const FontDescription& fontDescription = font->fontDescription();
@@ -63,7 +62,7 @@ public:
if (!m_shapeByWord) {
if (m_startIndex)
return false;
- *wordResult = shapeWord(m_textRun, m_font, m_fallbackFonts);
+ *wordResult = shapeWord(m_textRun, m_font);
m_startIndex = 1;
return *wordResult;
}
@@ -72,7 +71,7 @@ public:
if (m_startIndex < length) {
if (m_textRun[m_startIndex] == spaceCharacter) {
TextRun wordRun = m_textRun.subRun(m_startIndex, 1);
- *wordResult = shapeWord(wordRun, m_font, m_fallbackFonts);
+ *wordResult = shapeWord(wordRun, m_font);
m_startIndex++;
return true;
}
@@ -81,7 +80,7 @@ public:
if (i == length || m_textRun[i] == spaceCharacter) {
TextRun wordRun = m_textRun.subRun(m_startIndex,
i - m_startIndex);
- *wordResult = shapeWord(wordRun, m_font, m_fallbackFonts);
+ *wordResult = shapeWord(wordRun, m_font);
m_startIndex = i;
return true;
}
@@ -91,31 +90,15 @@ public:
}
private:
- void setFallbackFonts(const ShapeResult* wordResult,
- HashSet<const SimpleFontData*>* fallbackFonts)
- {
- if (fallbackFonts) {
- const HashSet<const SimpleFontData*>* fontsForWord =
- wordResult->fallbackFonts();
- HashSet<const SimpleFontData*>::const_iterator it;
- for (it = fontsForWord->begin(); it != fontsForWord->end(); ++it)
- fallbackFonts->add(*it);
- }
- }
-
- PassRefPtr<ShapeResult> shapeWord(const TextRun& wordRun,
- const Font* font, HashSet<const SimpleFontData*>* fallbackFonts)
+ PassRefPtr<ShapeResult> shapeWord(const TextRun& wordRun, const Font* font)
{
ShapeCacheEntry* cacheEntry = m_wordResultCachable
? m_shapeCache->add(wordRun, ShapeCacheEntry())
: nullptr;
- if (cacheEntry && cacheEntry->m_shapeResult) {
- setFallbackFonts(cacheEntry->m_shapeResult.get(), fallbackFonts);
+ if (cacheEntry && cacheEntry->m_shapeResult)
return cacheEntry->m_shapeResult;
- }
- HashSet<const SimpleFontData*> fallbackFontsForWord;
- HarfBuzzShaper shaper(font, wordRun, &fallbackFontsForWord);
+ HarfBuzzShaper shaper(font, wordRun);
RefPtr<ShapeResult> shapeResult = shaper.shapeResult();
if (!shapeResult)
return nullptr;
@@ -123,14 +106,12 @@ private:
if (cacheEntry)
cacheEntry->m_shapeResult = shapeResult;
- setFallbackFonts(shapeResult.get(), fallbackFonts);
return shapeResult.release();
}
ShapeCache* m_shapeCache;
const TextRun& m_textRun;
const Font* m_font;
- HashSet<const SimpleFontData*>* m_fallbackFonts;
unsigned m_startIndex : 30;
unsigned m_wordResultCachable : 1;
unsigned m_shapeByWord : 1;
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | Source/platform/fonts/shaping/CachingWordShaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698