Changeset 176507 in webkit


Ignore:
Timestamp:
Nov 22, 2014 11:37:08 AM (9 years ago)
Author:
Antti Koivisto
Message:

Make locale part of the SimpleLineLayout::FlowContent::Style
https://bugs.webkit.org/show_bug.cgi?id=139004

Reviewed by Zalan Bujtas.

That's the only part of style not extracted out of RenderStyle in the constructor.

  • rendering/SimpleLineLayoutFlowContents.cpp:

(WebCore::SimpleLineLayout::FlowContents::Style::Style):
(WebCore::SimpleLineLayout::FlowContents::FlowContents):
(WebCore::SimpleLineLayout::FlowContents::appendNextRendererContentIfNeeded):

  • rendering/SimpleLineLayoutFlowContents.h:

Also remove RenderBlockFlow member since it is now unused.

(WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.

Move to cpp.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r176505 r176507  
     12014-11-22  Antti Koivisto  <antti@apple.com>
     2
     3        Make locale part of the SimpleLineLayout::FlowContent::Style
     4        https://bugs.webkit.org/show_bug.cgi?id=139004
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        That's the only part of style not extracted out of RenderStyle in the constructor.
     9
     10        * rendering/SimpleLineLayoutFlowContents.cpp:
     11        (WebCore::SimpleLineLayout::FlowContents::Style::Style):
     12        (WebCore::SimpleLineLayout::FlowContents::FlowContents):
     13        (WebCore::SimpleLineLayout::FlowContents::appendNextRendererContentIfNeeded):
     14        * rendering/SimpleLineLayoutFlowContents.h:
     15
     16            Also remove RenderBlockFlow member since it is now unused.
     17
     18        (WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.
     19
     20            Move to cpp.
     21
    1222014-11-22  Joanmarie Diggs  <jdiggs@igalia.com>
    223
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp

    r176473 r176507  
    3434namespace SimpleLineLayout {
    3535
     36FlowContents::Style::Style(const RenderStyle& style)
     37    : font(style.font())
     38    , textAlign(style.textAlign())
     39    , collapseWhitespace(style.collapseWhiteSpace())
     40    , preserveNewline(style.preserveNewline())
     41    , wrapLines(style.autoWrap())
     42    , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
     43    , spaceWidth(font.width(TextRun(&space, 1)))
     44    , tabWidth(collapseWhitespace ? 0 : style.tabSize())
     45    , locale(style.locale())
     46{
     47}
     48
    3649FlowContents::FlowContents(const RenderBlockFlow& flow)
    37     : m_flow(flow)
    38     , m_style(flow.style())
     50    : m_style(flow.style())
    3951    , m_lineBreakIterator(downcast<RenderText>(*flow.firstChild()).text(), flow.style().locale())
    4052    , m_lastRendererIndex(0)
    4153{
    4254    unsigned startPosition = 0;
    43     for (const RenderText* textRenderer = downcast<RenderText>(m_flow.firstChild()); textRenderer; textRenderer = downcast<RenderText>(textRenderer->nextSibling())) {
    44         unsigned contentLength = textRenderer->text()->length();
    45         m_textRanges.append(std::make_pair(startPosition, textRenderer));
     55    for (auto& textChild : childrenOfType<RenderText>(flow)) {
     56        unsigned contentLength = textChild.text()->length();
     57        m_textRanges.append(std::make_pair(startPosition, &textChild));
    4658        startPosition += contentLength;
    4759    }
     
    158170
    159171    ++m_lastRendererIndex;
    160     m_lineBreakIterator.resetStringAndReleaseIterator(string + String(nextRenderer->text()), m_flow.style().locale(), LineBreakIteratorModeUAX14);
     172    m_lineBreakIterator.resetStringAndReleaseIterator(string + String(nextRenderer->text()), m_style.locale, LineBreakIteratorModeUAX14);
    161173    return true;
    162174}
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h

    r176401 r176507  
    5252    const RenderText* renderer(unsigned position, unsigned* startPosition = nullptr) const;
    5353
    54     class Style {
    55     public:
    56         Style(const RenderStyle& style)
    57             : font(style.font())
    58             , textAlign(style.textAlign())
    59             , collapseWhitespace(style.collapseWhiteSpace())
    60             , preserveNewline(style.preserveNewline())
    61             , wrapLines(style.autoWrap())
    62             , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
    63             , spaceWidth(font.width(TextRun(&space, 1)))
    64             , tabWidth(collapseWhitespace ? 0 : style.tabSize())
    65         {
    66         }
     54    struct Style {
     55        explicit Style(const RenderStyle&);
    6756
    6857        const Font& font;
     
    7463        float spaceWidth;
    7564        unsigned tabWidth;
     65        AtomicString locale;
    7666    };
    7767    const Style& style() const { return m_style; }
     
    8272    float runWidth(const RenderText&, unsigned from, unsigned to, float xPosition) const;
    8373
    84     const RenderBlockFlow& m_flow;
    8574    const Style m_style;
    8675    mutable LazyLineBreakIterator m_lineBreakIterator;
Note: See TracChangeset for help on using the changeset viewer.