Index: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp |
index 3ba5eb883634d7416afcbf5c70b28eb08ff7906a..c237836ce4f9db5c3a169c37092f3cb340dbfc6e 100644 |
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp |
@@ -43,9 +43,14 @@ float CachingWordShaper::width(const Font* font, const TextRun& run, |
CachingWordShapeIterator iterator(m_shapeCache, run, font); |
while (iterator.next(&wordResult)) { |
if (wordResult) { |
+ if (glyphBounds) { |
+ FloatRect adjustedBounds = wordResult->bounds(); |
+ // Translate glyph bounds to the current glyph position which |
+ // is the total width before this glyph. |
+ adjustedBounds.setX(adjustedBounds.x() + width); |
+ glyphBounds->unite(adjustedBounds); |
+ } |
width += wordResult->width(); |
- if (glyphBounds) |
- glyphBounds->unite(wordResult->bounds()); |
if (fallbackFonts) |
wordResult->fallbackFonts(fallbackFonts); |
} |