| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * (C) 2008 Torch Mobile Inc. All rights reserved. | 3 * (C) 2008 Torch Mobile Inc. All rights reserved. |
| 4 * (http://www.torchmobile.com/) | 4 * (http://www.torchmobile.com/) |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 "#HeadLineA", | 195 "#HeadLineA", |
| 196 "#PCMyungjo", | 196 "#PCMyungjo", |
| 197 "#PilGi", | 197 "#PilGi", |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 // For font families where any of the fonts don't have a valid entry in the OS/2 | 200 // For font families where any of the fonts don't have a valid entry in the OS/2 |
| 201 // table for avgCharWidth, fallback to the legacy webkit behavior of getting the | 201 // table for avgCharWidth, fallback to the legacy webkit behavior of getting the |
| 202 // avgCharWidth from the width of a '0'. This only seems to apply to a fixed | 202 // avgCharWidth from the width of a '0'. This only seems to apply to a fixed |
| 203 // number of Mac fonts, but, in order to get similar rendering across platforms, | 203 // number of Mac fonts, but, in order to get similar rendering across platforms, |
| 204 // we do this check for all platforms. | 204 // we do this check for all platforms. |
| 205 bool LayoutTextControl::hasValidAvgCharWidth(const SimpleFontData* font, | 205 bool LayoutTextControl::hasValidAvgCharWidth(const SimpleFontData* fontData, |
| 206 const AtomicString& family) { | 206 const AtomicString& family) { |
| 207 // Some fonts match avgCharWidth to CJK full-width characters. | 207 // Some fonts match avgCharWidth to CJK full-width characters. |
| 208 // Heuristic check to avoid such fonts. | 208 // Heuristic check to avoid such fonts. |
| 209 DCHECK(font); | 209 DCHECK(fontData); |
| 210 const FontMetrics& metrics = font->getFontMetrics(); | 210 if (fontData) { |
| 211 if (metrics.hasZeroWidth() && | 211 const FontMetrics& metrics = fontData->getFontMetrics(); |
| 212 font->avgCharWidth() > metrics.zeroWidth() * 1.7) | 212 if (metrics.hasZeroWidth() && |
| 213 return false; | 213 fontData->avgCharWidth() > metrics.zeroWidth() * 1.7) |
| 214 return false; |
| 215 } |
| 214 | 216 |
| 215 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = nullptr; | 217 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = nullptr; |
| 216 | 218 |
| 217 if (family.isEmpty()) | 219 if (family.isEmpty()) |
| 218 return false; | 220 return false; |
| 219 | 221 |
| 220 if (!fontFamiliesWithInvalidCharWidthMap) { | 222 if (!fontFamiliesWithInvalidCharWidthMap) { |
| 221 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>; | 223 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>; |
| 222 | 224 |
| 223 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); | 225 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 LayoutObject* placeholderLayoutObject = | 326 LayoutObject* placeholderLayoutObject = |
| 325 placeholder ? placeholder->layoutObject() : nullptr; | 327 placeholder ? placeholder->layoutObject() : nullptr; |
| 326 if (!placeholderLayoutObject) | 328 if (!placeholderLayoutObject) |
| 327 return nullptr; | 329 return nullptr; |
| 328 if (relayoutChildren) | 330 if (relayoutChildren) |
| 329 layoutScope.setChildNeedsLayout(placeholderLayoutObject); | 331 layoutScope.setChildNeedsLayout(placeholderLayoutObject); |
| 330 return placeholderLayoutObject; | 332 return placeholderLayoutObject; |
| 331 } | 333 } |
| 332 | 334 |
| 333 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |