Changeset 154674 in webkit
- Timestamp:
- Aug 27, 2013 3:22:20 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154673 r154674 1 2013-08-27 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 Font's fast code path doesn't handle partial runs correctly when kerning or ligatures are enabled 4 https://bugs.webkit.org/show_bug.cgi?id=100050 5 6 Reviewed by Darin Adler. 7 8 Renamed m_characterIndex to m_characterIndexOfGlyph and gave it an inline size of 10, 9 which covers around 66% of all cases. The rest of the cases are now preallocated to the 10 upper limit which is length of the original TextRun. 11 12 * platform/graphics/FontFastPath.cpp: 13 (WebCore::Font::getGlyphsAndAdvancesForSimpleText): 14 (WebCore::Font::selectionRectForSimpleText): 15 (WebCore::Font::offsetForPositionForSimpleText): 16 * platform/graphics/WidthIterator.cpp: 17 (WebCore::WidthIterator::WidthIterator): 18 (WebCore::WidthIterator::advanceInternal): 19 * platform/graphics/WidthIterator.h: 20 1 21 2013-08-27 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 22 -
trunk/Source/WebCore/platform/graphics/FontFastPath.cpp
r154384 r154674 140 140 float beforeWidth = 0; 141 141 int glyphPos = 0; 142 for (; glyphPos < localGlyphBuffer.size() && it.m_characterIndex [glyphPos] < from; ++glyphPos)142 for (; glyphPos < localGlyphBuffer.size() && it.m_characterIndexOfGlyph[glyphPos] < from; ++glyphPos) 143 143 beforeWidth += localGlyphBuffer.advanceAt(glyphPos).width(); 144 144 int glyphFrom = glyphPos; … … 146 146 float afterWidth = totalWidth; 147 147 glyphPos = localGlyphBuffer.size() - 1; 148 for (; glyphPos >= glyphFrom && it.m_characterIndex [glyphPos] >= to; --glyphPos)148 for (; glyphPos >= glyphFrom && it.m_characterIndexOfGlyph[glyphPos] >= to; --glyphPos) 149 149 afterWidth -= localGlyphBuffer.advanceAt(glyphPos).width(); 150 150 int glyphTo = glyphPos + 1; … … 304 304 float beforeWidth = 0; 305 305 int glyphPos = 0; 306 for (; glyphPos < glyphBuffer.size() && it.m_characterIndex [glyphPos] < from; ++glyphPos)306 for (; glyphPos < glyphBuffer.size() && it.m_characterIndexOfGlyph[glyphPos] < from; ++glyphPos) 307 307 beforeWidth += glyphBuffer.advanceAt(glyphPos).width(); 308 308 int glyphFrom = glyphPos; … … 310 310 float afterWidth = totalWidth; 311 311 glyphPos = glyphBuffer.size() - 1; 312 for (; glyphPos >= glyphFrom && it.m_characterIndex [glyphPos] >= to; --glyphPos)312 for (; glyphPos >= glyphFrom && it.m_characterIndexOfGlyph[glyphPos] >= to; --glyphPos) 313 313 afterWidth -= glyphBuffer.advanceAt(glyphPos).width(); 314 314 … … 335 335 break; 336 336 } 337 characterOffset = it.m_characterIndex [glyphPosition];337 characterOffset = it.m_characterIndexOfGlyph[glyphPosition]; 338 338 float glyphWidth = glyphBuffer.advanceAt(glyphPosition).width(); 339 339 if (includePartialGlyphs) { … … 353 353 break; 354 354 } 355 characterOffset = it.m_characterIndex [glyphPosition];355 characterOffset = it.m_characterIndexOfGlyph[glyphPosition]; 356 356 float glyphWidth = glyphBuffer.advanceAt(glyphPosition).width(); 357 357 if (includePartialGlyphs) { -
trunk/Source/WebCore/platform/graphics/WidthIterator.cpp
r154384 r154674 68 68 m_expansionPerOpportunity = m_expansion / expansionOpportunityCount; 69 69 } 70 // Character-index will end up the same or slightly shorter than m_run, so if we reserve that much it will never need to resize. 71 m_characterIndexOfGlyph.reserveInitialCapacity(m_run.length()); 70 72 } 71 73 … … 232 234 else 233 235 glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity); 234 m_characterIndex .append(currentCharacterIndex);236 m_characterIndexOfGlyph.append(currentCharacterIndex); 235 237 } else 236 238 glyphBuffer->expandLastAdvance(expansionAtThisOpportunity); … … 301 303 if (glyphBuffer) { 302 304 glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width)); 303 m_characterIndex .append(currentCharacterIndex);305 m_characterIndexOfGlyph.append(currentCharacterIndex); 304 306 } 305 307 -
trunk/Source/WebCore/platform/graphics/WidthIterator.h
r154384 r154674 83 83 bool m_isAfterExpansion; 84 84 float m_finalRoundingWidth; 85 Vector<int> m_characterIndex; 85 // An inline capacity of 10 catches around 2/3 of the cases. To catch 90% we would need 32. 86 Vector<int, 10> m_characterIndexOfGlyph; 86 87 87 88 #if ENABLE(SVG_FONTS)
Note: See TracChangeset
for help on using the changeset viewer.