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

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

Issue 206793005: Expand WidthCache for complex text width queries (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Source/platform/fonts/WidthCache.h » ('j') | 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 722ac9d117e28d2e0fc9f9f9ea65a5d1f096aa98..c3308777fbdfbb7d3c7f4fa742a7ca980107d99d 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -150,10 +150,15 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
}
bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kerning | Ligatures);
- bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing();
- float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow);
- if (cacheEntry && !std::isnan(*cacheEntry))
- return *cacheEntry;
+ float* cacheEntry;
+ if (codePathToUse == ComplexPath || hasKerningOrLigatures) {
Dominik Röttsches 2014/03/21 06:24:48 Now the decision on whether the cache is used is i
+ bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing();
+ cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasWordSpacingOrLetterSpacing, glyphOverflow);
+ if (cacheEntry && !std::isnan(*cacheEntry))
+ return *cacheEntry;
+ } else {
+ cacheEntry = 0;
+ }
float result;
if (codePathToUse == ComplexPath)
« no previous file with comments | « no previous file | Source/platform/fonts/WidthCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698