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

Unified Diff: third_party/WebKit/Source/platform/fonts/Font.cpp

Issue 2718043003: Refactor InspectorCSSAgent to avoid an intermediate GlyphBuffer (Closed)
Patch Set: cleanup Created 3 years, 10 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
Index: third_party/WebKit/Source/platform/fonts/Font.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp
index 5811f909148aacfcbc1010ca487ff1826dfed00a..48337338adbabc5d6713e44ca7e45d41298fe1ea 100644
--- a/third_party/WebKit/Source/platform/fonts/Font.cpp
+++ b/third_party/WebKit/Source/platform/fonts/Font.cpp
@@ -109,13 +109,13 @@ float Font::buildGlyphBuffer(const TextRunPaintInfo& runInfo,
GlyphBuffer& glyphBuffer,
const GlyphData* emphasisData) const {
float width;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
+ CachingWordShaper shaper(*this);
if (emphasisData) {
- width = shaper.fillGlyphBufferForTextEmphasis(this, runInfo.run,
+ width = shaper.fillGlyphBufferForTextEmphasis(runInfo.run,
emphasisData, &glyphBuffer,
runInfo.from, runInfo.to);
} else {
- width = shaper.fillGlyphBuffer(this, runInfo.run, nullptr, &glyphBuffer,
+ width = shaper.fillGlyphBuffer(runInfo.run, &glyphBuffer,
runInfo.from, runInfo.to);
}
return width;
@@ -224,9 +224,8 @@ float Font::width(const TextRun& run,
HashSet<const SimpleFontData*>* fallbackFonts,
FloatRect* glyphBounds) const {
FontCachePurgePreventer purgePreventer;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
- float width = shaper.width(this, run, fallbackFonts, glyphBounds);
- return width;
+ CachingWordShaper shaper(*this);
+ return shaper.width(run, fallbackFonts, glyphBounds);
}
namespace {
@@ -438,8 +437,8 @@ FloatRect Font::selectionRectForText(const TextRun& run,
FontCachePurgePreventer purgePreventer;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
- CharacterRange range = shaper.getCharacterRange(this, run, from, to);
+ CachingWordShaper shaper(*this);
+ CharacterRange range = shaper.getCharacterRange(run, from, to);
return pixelSnappedSelectionRect(
FloatRect(point.x() + range.start, point.y(), range.width(), height));
@@ -449,8 +448,8 @@ int Font::offsetForPosition(const TextRun& run,
float xFloat,
bool includePartialGlyphs) const {
FontCachePurgePreventer purgePreventer;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
- return shaper.offsetForPosition(this, run, xFloat, includePartialGlyphs);
+ CachingWordShaper shaper(*this);
+ return shaper.offsetForPosition(run, xFloat, includePartialGlyphs);
}
ShapeCache* Font::shapeCache() const {
@@ -561,15 +560,15 @@ CharacterRange Font::getCharacterRange(const TextRun& run,
unsigned from,
unsigned to) const {
FontCachePurgePreventer purgePreventer;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
- return shaper.getCharacterRange(this, run, from, to);
+ CachingWordShaper shaper(*this);
+ return shaper.getCharacterRange(run, from, to);
}
Vector<CharacterRange> Font::individualCharacterRanges(
const TextRun& run) const {
FontCachePurgePreventer purgePreventer;
- CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription));
- auto ranges = shaper.individualCharacterRanges(this, run);
+ CachingWordShaper shaper(*this);
+ auto ranges = shaper.individualCharacterRanges(run);
// The shaper should return ranges.size == run.length but on some platforms
// (OSX10.9.5) we are seeing cases in the upper end of the unicode range
// where this is not true (see: crbug.com/620952). To catch these cases on
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Font.h ('k') | third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698