Changeset 94778 in webkit
- Timestamp:
- Sep 8, 2011 12:18:43 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r94777 r94778 1 2011-09-08 Ned Holbrook <nholbrook@apple.com> 2 3 Refactor hyphen measurement 4 https://bugs.webkit.org/show_bug.cgi?id=67728 5 6 Reviewed by Darin Adler. 7 8 No new tests, purely refactoring. 9 10 * rendering/RenderBlockLineLayout.cpp: 11 (WebCore::measureHyphenWidth): Added. 12 (WebCore::setLogicalWidthForTextRun): Use measureHyphenWidth(). 13 (WebCore::tryHyphenating): Ditto. 14 (WebCore::RenderBlock::LineBreaker::nextLineBreak): Ditto. 15 1 16 2011-09-08 Julien Chaffraix <jchaffraix@webkit.org> 2 17 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r94775 r94778 479 479 } 480 480 481 static inline float measureHyphenWidth(RenderText* renderer, const Font& font) 482 { 483 RenderStyle* style = renderer->style(); 484 return font.width(RenderBlock::constructTextRun(renderer, font, style->hyphenString().string(), style)); 485 } 486 481 487 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* run, RenderText* renderer, float xPos, const LineInfo& lineInfo, 482 488 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache) … … 501 507 int hyphenWidth = 0; 502 508 if (toInlineTextBox(run->m_box)->hasHyphen()) { 503 const AtomicString& hyphenString = renderer->style()->hyphenString();504 509 const Font& font = renderer->style(lineInfo.isFirstLine())->font(); 505 hyphenWidth = font.width(RenderBlock::constructTextRun(renderer, font, hyphenString.string(), renderer->style()));510 hyphenWidth = measureHyphenWidth(renderer, font); 506 511 } 507 512 run->m_box->setLogicalWidth(renderer->width(run->m_start, run->m_stop - run->m_start, xPos, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow) + hyphenWidth); … … 1754 1759 return; 1755 1760 1756 const AtomicString& hyphenString = text->style()->hyphenString(); 1757 int hyphenWidth = font.width(RenderBlock::constructTextRun(text, font, hyphenString.string(), text->style())); 1761 int hyphenWidth = measureHyphenWidth(text, font); 1758 1762 1759 1763 float maxPrefixWidth = availableWidth - xPos - hyphenWidth - lastSpaceWordSpacing; … … 2255 2259 2256 2260 if (c == softHyphen && autoWrap && !hyphenWidth && style->hyphens() != HyphensNone) { 2257 const AtomicString& hyphenString = style->hyphenString(); 2258 hyphenWidth = f.width(constructTextRun(t, f, hyphenString.string(), current.m_obj->style())); 2261 hyphenWidth = measureHyphenWidth(t, f); 2259 2262 width.addUncommittedWidth(hyphenWidth); 2260 2263 }
Note: See TracChangeset
for help on using the changeset viewer.