Changeset 58467 in webkit
- Timestamp:
- Apr 28, 2010, 8:11:37 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58466 r58467 1 2010-04-28 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Adele Peterson. 4 5 More of <rdar://problem/7855777> REGRESSION: Memory usage increase caused by storing glyph bounds in GlyphMetricsMap 6 https://bugs.webkit.org/show_bug.cgi?id=37936 7 8 Assigning zero width and empty bounds to the ZERO WIDTH SPACE glyph often allocates a width map 9 page and a bounds map page for the glyph, each of which pages contains 255 unused entries. Save 10 this space by not storing the zero width and empty bounds in the metrics maps. 11 12 * platform/graphics/SimpleFontData.cpp: 13 (WebCore::SimpleFontData::SimpleFontData): Initialize m_zeroWidthSpaceGlyph. 14 (WebCore::SimpleFontData::platformGlyphInit): Set m_zeroWidthSpaceGlyph. Don’t create entries 15 for the ZERO WIDTH SPACE glyph in the width map and in the bounds map. 16 * platform/graphics/SimpleFontData.h: 17 (WebCore::SimpleFontData::boundsForGlyph): Return empty bounds for the ZERO WIDTH SPACE glyph 18 without consulting the bounds map. 19 (WebCore::SimpleFontData::widthForGlyph): Return zero for the ZERO WIDTH SPACE glyph without 20 consulting the width map. 21 1 22 2010-04-28 Mark Rowe <mrowe@apple.com> 2 23 -
trunk/WebCore/platform/graphics/SimpleFontData.cpp
r58192 r58467 93 93 // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above? 94 94 m_spaceGlyph = 0; 95 m_zeroWidthSpaceGlyph = 0; 95 96 determinePitch(); 96 97 m_adjustedSpaceWidth = roundf(m_spaceWidth); … … 137 138 m_adjustedSpaceWidth = 0; 138 139 determinePitch(); 140 m_zeroWidthSpaceGlyph = 0; 139 141 m_missingGlyphData.fontData = this; 140 142 m_missingGlyphData.glyph = 0; … … 156 158 // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0, 157 159 // are mapped to the ZERO WIDTH SPACE glyph. 158 Glyph zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph; 159 if (zeroWidthSpaceGlyph) { 160 if (zeroWidthSpaceGlyph != m_spaceGlyph) { 161 m_glyphToWidthMap.setMetricsForGlyph(zeroWidthSpaceGlyph, 0); 162 m_glyphToBoundsMap.setMetricsForGlyph(zeroWidthSpaceGlyph, FloatRect()); 163 } else 164 LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width not overridden."); 160 m_zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph; 161 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) { 162 m_zeroWidthSpaceGlyph = 0; 163 LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width will not be overridden."); 165 164 } 166 165 -
trunk/WebCore/platform/graphics/SimpleFontData.h
r58192 r58467 201 201 float m_adjustedSpaceWidth; 202 202 203 Glyph m_zeroWidthSpaceGlyph; 204 203 205 GlyphData m_missingGlyphData; 204 206 … … 244 246 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const 245 247 { 248 if (glyph == m_zeroWidthSpaceGlyph && glyph) 249 return FloatRect(); 250 246 251 FloatRect bounds = m_glyphToBoundsMap.metricsForGlyph(glyph); 247 252 if (bounds.width() != cGlyphSizeUnknown) 248 253 return bounds; 254 249 255 bounds = platformBoundsForGlyph(glyph); 250 256 m_glyphToBoundsMap.setMetricsForGlyph(glyph, bounds); … … 254 260 ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const 255 261 { 262 if (glyph == m_zeroWidthSpaceGlyph && glyph) 263 return 0; 264 256 265 float width = m_glyphToWidthMap.metricsForGlyph(glyph); 257 266 if (width != cGlyphSizeUnknown)
Note:
See TracChangeset
for help on using the changeset viewer.