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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp

Issue 1524913003: Account for total glyph overflow in CachingWordShaper::width (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ace of rebase Created 5 years 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698