Commit 6d674545 authored by fmalita@chromium.org's avatar fmalita@chromium.org

Remove redundant typesetting checks from Font::width()

Minor cleanup: Font::codePath() already selects ComplexPath whenever
typesettingFeatures are present (our SimplePath doesn't support kerning
and ligatures), so there's no need to duplicate that test in width().

R=schenney@chromium.org,jbroman@chromium.org,eae@chromium.org

Review URL: https://codereview.chromium.org/401123005

git-svn-id: svn://svn.chromium.org/blink/trunk@178557 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9206c8a8
...@@ -160,9 +160,8 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo ...@@ -160,9 +160,8 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
glyphOverflow = 0; glyphOverflow = 0;
} }
bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kerning | Ligatures);
bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing(); 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. && !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. && !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 ...@@ -180,8 +179,8 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
if (codePathToUse == ComplexPath) { if (codePathToUse == ComplexPath) {
result = floatWidthForComplexText(run, fallbackFonts, &glyphBounds); result = floatWidthForComplexText(run, fallbackFonts, &glyphBounds);
} else { } else {
result = floatWidthForSimpleText(run, fallbackFonts, ASSERT(!isCacheable);
glyphOverflow || isCacheable ? &glyphBounds : 0); result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow ? &glyphBounds : 0);
} }
if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) { if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment