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

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

Issue 401123005: Remove redundant typesetting checks from Font::width() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index f25a76fd3f12ee925ec1766c8d49a6504d3a8382..4670177678ea1905f4674086d1fb66348e4f4ca6 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -160,9 +160,8 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
glyphOverflow = 0;
}
- bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kerning | Ligatures);
bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing();
- bool isCacheable = (codePathToUse == ComplexPath || hasKerningOrLigatures)
+ bool isCacheable = codePathToUse == ComplexPath
&& !hasWordSpacingOrLetterSpacing // Word spacing and letter spacing can change the width of a word.
&& !run.allowTabs(); // If we allow tabs and a tab occurs inside a word, the width of the word varies based on its position on the line.
@@ -180,8 +179,8 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
if (codePathToUse == ComplexPath) {
result = floatWidthForComplexText(run, fallbackFonts, &glyphBounds);
} else {
- result = floatWidthForSimpleText(run, fallbackFonts,
- glyphOverflow || isCacheable ? &glyphBounds : 0);
+ ASSERT(!isCacheable);
+ result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow ? &glyphBounds : 0);
}
if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698