Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
index dba7381e35fc88894dab22c4c1bcbb2616ff11df..ae371f2ddf861c0ac54819b6f2c595acb4d85287 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
@@ -370,7 +370,7 @@ static void normalizeCharacters(const TextRun& run, unsigned length, UChar* dest |
} |
} |
-HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, ForTextEmphasisOrNot forTextEmphasis, HashSet<const SimpleFontData*>* fallbackFonts) |
+HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, ForTextEmphasisOrNot forTextEmphasis, HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* bounds) |
: m_font(font) |
, m_normalizedBufferLength(0) |
, m_run(run) |
@@ -382,6 +382,7 @@ HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, ForTextEmph |
, m_fromIndex(0) |
, m_toIndex(m_run.length()) |
, m_forTextEmphasis(forTextEmphasis) |
+ , m_glyphBoundingBox(bounds) |
, m_fallbackFonts(fallbackFonts) |
{ |
m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); |
@@ -929,10 +930,12 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb |
currentRun->setGlyphAndPositions(i, glyph, advance, offsetX, offsetY); |
- FloatRect glyphBounds = currentFontData->boundsForGlyph(glyph); |
- glyphBounds.move(glyphOrigin.x(), glyphOrigin.y()); |
- m_glyphBoundingBox.unite(glyphBounds); |
- glyphOrigin += FloatSize(advance + offsetX, offsetY); |
+ if (m_glyphBoundingBox) { |
+ FloatRect glyphBounds = currentFontData->boundsForGlyph(glyph); |
+ glyphBounds.move(glyphOrigin.x(), glyphOrigin.y()); |
+ m_glyphBoundingBox->unite(glyphBounds); |
+ glyphOrigin += FloatSize(advance + offsetX, offsetY); |
+ } |
totalAdvance += advance; |
} |