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

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

Issue 2020863002: Guard against invalid glyph shaping results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/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 04d38a082bdbab31f04e79092e94c2e6d9db3cd5..d9ba993fa3b54f2e63a899c889c252aed851209f 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
@@ -123,7 +123,13 @@ Vector<CharacterRange> CachingWordShaper::individualCharacterRanges(
float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
&buffer);
- return buffer.individualCharacterRanges(run.direction(), totalWidth);
+ auto ranges = buffer.individualCharacterRanges(run.direction(), totalWidth);
+ // The shaper can fail to return glyph metrics for all characters (see
+ // crbug.com/613915) so add empty ranges to ensure all characters have an
+ // associated range.
+ while (ranges.size() < static_cast<unsigned>(run.length()))
fs 2016/05/28 14:08:31 So this will do all the padding "at the end", whil
pdr. 2016/05/28 22:58:16 Great questions. Ultimately I think this should b
fs 2016/05/29 14:35:55 Yes, I do prefer less pairs of belts and suspender
+ ranges.append(CharacterRange(0, 0));
+ return ranges;
}
}; // namespace blink

Powered by Google App Engine
This is Rietveld 408576698