Changeset 94778 in webkit


Ignore:
Timestamp:
Sep 8, 2011 12:18:43 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Refactor hyphen measurement
https://bugs.webkit.org/show_bug.cgi?id=67728

Patch by Ned Holbrook <nholbrook@apple.com> on 2011-09-08
Reviewed by Darin Adler.

No new tests, purely refactoring.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::measureHyphenWidth): Added.
(WebCore::setLogicalWidthForTextRun): Use measureHyphenWidth().
(WebCore::tryHyphenating): Ditto.
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Ditto.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94777 r94778  
     12011-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
    1162011-09-08  Julien Chaffraix  <jchaffraix@webkit.org>
    217
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r94775 r94778  
    479479}
    480480
     481static 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
    481487static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* run, RenderText* renderer, float xPos, const LineInfo& lineInfo,
    482488                                   GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
     
    501507    int hyphenWidth = 0;
    502508    if (toInlineTextBox(run->m_box)->hasHyphen()) {
    503         const AtomicString& hyphenString = renderer->style()->hyphenString();
    504509        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);
    506511    }
    507512    run->m_box->setLogicalWidth(renderer->width(run->m_start, run->m_stop - run->m_start, xPos, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow) + hyphenWidth);
     
    17541759        return;
    17551760
    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);
    17581762
    17591763    float maxPrefixWidth = availableWidth - xPos - hyphenWidth - lastSpaceWordSpacing;
     
    22552259
    22562260                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);
    22592262                    width.addUncommittedWidth(hyphenWidth);
    22602263                }
Note: See TracChangeset for help on using the changeset viewer.