Chromium Code Reviews| Index: Source/core/rendering/RenderText.cpp |
| diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp |
| index 665277d29d13e04643971b1fb9e7d6e5cf5422fe..aaace2313169c1d4173d1880c296e5911e2cc9a4 100644 |
| --- a/Source/core/rendering/RenderText.cpp |
| +++ b/Source/core/rendering/RenderText.cpp |
| @@ -721,23 +721,31 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len |
| } |
| if (f.isFixedPitch() && f.fontDescription().variant() == FontVariantNormal && m_isAllASCII && (!glyphOverflow || !glyphOverflow->computeBounds)) { |
| + bool missingGlyph = false; |
| float monospaceCharacterWidth = f.spaceWidth(); |
| float w = 0; |
| bool isSpace; |
| ASSERT(m_text); |
| StringImpl& text = *m_text.impl(); |
| + RenderStyle * renderStyle = style(); |
|
Dominik Röttsches
2014/12/15 09:49:00
No space between type name and *.
http://www.chrom
h.joshi
2014/12/16 07:02:20
Done.
|
| for (int i = start; i < start + len; i++) { |
| char c = text[i]; |
| + // If glyph is not present in primary font then we cannot calculate width based on primary |
| + // font property, we need to call "width" method of Font Object. |
| + if (!f.primaryFontHasGlyphForCharacter(text[i])) { |
| + missingGlyph = true; |
| + break; |
| + } |
| if (c <= space) { |
| if (c == space || c == newlineCharacter) { |
| w += monospaceCharacterWidth; |
| isSpace = true; |
| } else if (c == characterTabulation) { |
| - if (style()->collapseWhiteSpace()) { |
| + if (renderStyle->collapseWhiteSpace()) { |
| w += monospaceCharacterWidth; |
| isSpace = true; |
| } else { |
| - w += f.tabWidth(style()->tabSize(), xPos + w); |
| + w += f.tabWidth(renderStyle->tabSize(), xPos + w); |
| isSpace = false; |
| } |
| } else |
| @@ -749,7 +757,8 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len |
| if (isSpace && i > start) |
| w += f.fontDescription().wordSpacing(); |
| } |
| - return w; |
| + if (!missingGlyph) |
| + return w; |
| } |
| TextRun run = constructTextRun(const_cast<RenderText*>(this), f, this, start, len, style(), textDirection); |