Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 if (codePathToUse != ComplexPath) { | 143 if (codePathToUse != ComplexPath) { |
| 144 // The complex path is more restrictive about returning fallback fonts t han the simple path, so we need an explicit test to make their behaviors match. | 144 // The complex path is more restrictive about returning fallback fonts t han the simple path, so we need an explicit test to make their behaviors match. |
| 145 if (!FontPlatformFeatures::canReturnFallbackFontsForComplexText()) | 145 if (!FontPlatformFeatures::canReturnFallbackFontsForComplexText()) |
| 146 fallbackFonts = 0; | 146 fallbackFonts = 0; |
| 147 // The simple path can optimize the case where glyph overflow is not obs ervable. | 147 // The simple path can optimize the case where glyph overflow is not obs ervable. |
| 148 if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !g lyphOverflow->computeBounds)) | 148 if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !g lyphOverflow->computeBounds)) |
| 149 glyphOverflow = 0; | 149 glyphOverflow = 0; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kern ing | Ligatures); | 152 bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kern ing | Ligatures); |
| 153 bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || font Description().letterSpacing(); | 153 float* cacheEntry; |
| 154 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow); | 154 if (codePathToUse == ComplexPath || hasKerningOrLigatures) { |
|
Dominik Röttsches
2014/03/21 06:24:48
Now the decision on whether the cache is used is i
| |
| 155 if (cacheEntry && !std::isnan(*cacheEntry)) | 155 bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing(); |
| 156 return *cacheEntry; | 156 cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_limi ts<float>::quiet_NaN(), hasWordSpacingOrLetterSpacing, glyphOverflow); |
| 157 if (cacheEntry && !std::isnan(*cacheEntry)) | |
| 158 return *cacheEntry; | |
| 159 } else { | |
| 160 cacheEntry = 0; | |
| 161 } | |
| 157 | 162 |
| 158 float result; | 163 float result; |
| 159 if (codePathToUse == ComplexPath) | 164 if (codePathToUse == ComplexPath) |
| 160 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); | 165 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); |
| 161 else | 166 else |
| 162 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); | 167 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); |
| 163 | 168 |
| 164 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) | 169 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) |
| 165 *cacheEntry = result; | 170 *cacheEntry = result; |
| 166 return result; | 171 return result; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 if (delta <= 0) | 825 if (delta <= 0) |
| 821 break; | 826 break; |
| 822 } | 827 } |
| 823 } | 828 } |
| 824 } | 829 } |
| 825 | 830 |
| 826 return offset; | 831 return offset; |
| 827 } | 832 } |
| 828 | 833 |
| 829 } | 834 } |
| OLD | NEW |