Changeset 256437 in webkit


Ignore:
Timestamp:
Feb 12, 2020 7:53:36 AM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Rename Display::Run::TextContext to TextContent
https://bugs.webkit.org/show_bug.cgi?id=207611
<rdar://problem/59374523>

Reviewed by Antti Koivisto.

  • layout/Verification.cpp:

(WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
(WebCore::Layout::checkForMatchingTextRuns):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):

  • layout/displaytree/DisplayPainter.cpp:

(WebCore::Display::paintInlineContent):

  • layout/displaytree/DisplayRun.h:

(WebCore::Display::Run::setTextContent):
(WebCore::Display::Run::textContent const):
(WebCore::Display::Run::textContent):
(WebCore::Display::Run::isLineBreak const):
(WebCore::Display::Run::Run):
(WebCore::Display::Run::TextContent::TextContent):
(WebCore::Display::Run::TextContext::start const): Deleted.
(WebCore::Display::Run::TextContext::end const): Deleted.
(WebCore::Display::Run::TextContext::length const): Deleted.
(WebCore::Display::Run::TextContext::content const): Deleted.
(WebCore::Display::Run::TextContext::needsHyphen const): Deleted.
(WebCore::Display::Run::TextContext::setNeedsHyphen): Deleted.
(WebCore::Display::Run::TextContext::expand): Deleted.
(WebCore::Display::Run::setTextContext): Deleted.
(WebCore::Display::Run::textContext const): Deleted.
(WebCore::Display::Run::textContext): Deleted.
(WebCore::Display::Run::TextContext::TextContext): Deleted.

  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):

  • layout/inlineformatting/InlineLineBuilder.cpp:

(WebCore::Layout::m_textContent):
(WebCore::Layout::LineBuilder::Run::expand):
(WebCore::Layout::LineBuilder::Run::removeTrailingWhitespace):
(WebCore::Layout::m_textContext): Deleted.

  • layout/inlineformatting/InlineLineBuilder.h:

(WebCore::Layout::LineBuilder::Run::textContent const):
(WebCore::Layout::LineBuilder::Run::textContext const): Deleted.

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::paint):

  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::outputInlineRuns):

  • rendering/line/LineLayoutTraversalDisplayRunPath.h:

(WebCore::LineLayoutTraversal::DisplayRunPath::hasHyphen const):
(WebCore::LineLayoutTraversal::DisplayRunPath::text const):
(WebCore::LineLayoutTraversal::DisplayRunPath::localStartOffset const):
(WebCore::LineLayoutTraversal::DisplayRunPath::localEndOffset const):
(WebCore::LineLayoutTraversal::DisplayRunPath::length const):

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r256436 r256437  
     12020-02-12  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Rename Display::Run::TextContext to TextContent
     4        https://bugs.webkit.org/show_bug.cgi?id=207611
     5        <rdar://problem/59374523>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * layout/Verification.cpp:
     10        (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
     11        (WebCore::Layout::checkForMatchingTextRuns):
     12        (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
     13        * layout/displaytree/DisplayPainter.cpp:
     14        (WebCore::Display::paintInlineContent):
     15        * layout/displaytree/DisplayRun.h:
     16        (WebCore::Display::Run::setTextContent):
     17        (WebCore::Display::Run::textContent const):
     18        (WebCore::Display::Run::textContent):
     19        (WebCore::Display::Run::isLineBreak const):
     20        (WebCore::Display::Run::Run):
     21        (WebCore::Display::Run::TextContent::TextContent):
     22        (WebCore::Display::Run::TextContext::start const): Deleted.
     23        (WebCore::Display::Run::TextContext::end const): Deleted.
     24        (WebCore::Display::Run::TextContext::length const): Deleted.
     25        (WebCore::Display::Run::TextContext::content const): Deleted.
     26        (WebCore::Display::Run::TextContext::needsHyphen const): Deleted.
     27        (WebCore::Display::Run::TextContext::setNeedsHyphen): Deleted.
     28        (WebCore::Display::Run::TextContext::expand): Deleted.
     29        (WebCore::Display::Run::setTextContext): Deleted.
     30        (WebCore::Display::Run::textContext const): Deleted.
     31        (WebCore::Display::Run::textContext): Deleted.
     32        (WebCore::Display::Run::TextContext::TextContext): Deleted.
     33        * layout/inlineformatting/InlineFormattingContext.cpp:
     34        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
     35        * layout/inlineformatting/InlineLineBuilder.cpp:
     36        (WebCore::Layout::m_textContent):
     37        (WebCore::Layout::LineBuilder::Run::expand):
     38        (WebCore::Layout::LineBuilder::Run::removeTrailingWhitespace):
     39        (WebCore::Layout::m_textContext): Deleted.
     40        * layout/inlineformatting/InlineLineBuilder.h:
     41        (WebCore::Layout::LineBuilder::Run::textContent const):
     42        (WebCore::Layout::LineBuilder::Run::textContext const): Deleted.
     43        * layout/integration/LayoutIntegrationLineLayout.cpp:
     44        (WebCore::LayoutIntegration::LineLayout::paint):
     45        * layout/layouttree/LayoutTreeBuilder.cpp:
     46        (WebCore::Layout::outputInlineRuns):
     47        * rendering/line/LineLayoutTraversalDisplayRunPath.h:
     48        (WebCore::LineLayoutTraversal::DisplayRunPath::hasHyphen const):
     49        (WebCore::LineLayoutTraversal::DisplayRunPath::text const):
     50        (WebCore::LineLayoutTraversal::DisplayRunPath::localStartOffset const):
     51        (WebCore::LineLayoutTraversal::DisplayRunPath::localEndOffset const):
     52        (WebCore::LineLayoutTraversal::DisplayRunPath::length const):
     53
    1542020-02-12  Charles Turner  <cturner@igalia.com>
    255
  • trunk/Source/WebCore/layout/Verification.cpp

    r256417 r256437  
    9797
    9898        auto matchingRuns = areEssentiallyEqual(simpleRun.logicalLeft, displayRun.left()) && areEssentiallyEqual(simpleRun.logicalRight, displayRun.right());
    99         if (matchingRuns && displayRun.textContext()) {
    100             matchingRuns = simpleRun.start == displayRun.textContext()->start() && simpleRun.end == displayRun.textContext()->end();
     99        if (matchingRuns && displayRun.textContent()) {
     100            matchingRuns = simpleRun.start == displayRun.textContent()->start() && simpleRun.end == displayRun.textContent()->end();
    101101            // SLL handles strings in a more concatenated format <div>foo<br>bar</div> -> foo -> 0,3 bar -> 3,6 vs. 0,3 and 0,3
    102102            if (!matchingRuns)
    103                 matchingRuns = (simpleRun.end - simpleRun.start) == (displayRun.textContext()->end() - displayRun.textContext()->start());
     103                matchingRuns = (simpleRun.end - simpleRun.start) == (displayRun.textContent()->end() - displayRun.textContent()->start());
    104104        }
    105105        if (matchingRuns)
     
    108108        stream << "Mismatching: simple run(" << simpleRun.start << ", " << simpleRun.end << ") (" << simpleRun.logicalLeft << ", " << simpleRun.logicalRight << ")";
    109109        stream << " inline run";
    110         if (displayRun.textContext())
    111             stream << " (" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
     110        if (displayRun.textContent())
     111            stream << " (" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")";
    112112        stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")";
    113113        stream.nextLine();
     
    132132        && areEssentiallyEqual(inlineTextBox.top(), inlineRun.top())
    133133        && areEssentiallyEqual(inlineTextBox.bottom(), inlineRun.bottom())
    134         && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == inlineRun.textContext()->start() && inlineTextBox.end() == inlineRun.textContext()->end()));
     134        && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == inlineRun.textContent()->start() && inlineTextBox.end() == inlineRun.textContent()->end()));
    135135}
    136136
     
    205205
    206206            stream << " inline run";
    207             if (displayRun.textContext())
    208                 stream << " (" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
     207            if (displayRun.textContent())
     208                stream << " (" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")";
    209209            stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")";
    210210            stream.nextLine();
  • trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp

    r256431 r256437  
    122122
    123123    for (auto& run : displayRuns) {
    124         if (auto& textContext = run.textContext()) {
     124        if (auto& textContent = run.textContent()) {
    125125            auto& style = run.style();
    126126            context.setStrokeColor(style.color());
     
    132132            auto baselineOffset = absoluteOffset.y() + lineBox.top() + lineBox.baselineOffset();
    133133            auto expansion = run.expansion();
    134             auto textRun = TextRun { textContext->content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
     134            auto textRun = TextRun { textContent->content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
    135135            textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
    136136            context.drawText(style.fontCascade(), textRun, { absoluteLeft, baselineOffset });
  • trunk/Source/WebCore/layout/displaytree/DisplayRun.h

    r256431 r256437  
    4141struct Run {
    4242    WTF_MAKE_STRUCT_FAST_ALLOCATED;
    43     struct TextContext {
     43    struct TextContent {
    4444        WTF_MAKE_STRUCT_FAST_ALLOCATED;
    4545    public:
    46         struct ExpansionContext;
    47         TextContext(unsigned position, unsigned length, const String&);
     46        TextContent(unsigned position, unsigned length, const String&);
    4847
    4948        unsigned start() const { return m_start; }
     
    6564
    6665    struct Expansion;
    67     Run(size_t lineIndex, const Layout::Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, Optional<TextContext> = WTF::nullopt);
     66    Run(size_t lineIndex, const Layout::Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, Optional<TextContent> = WTF::nullopt);
    6867
    6968    size_t lineIndex() const { return m_lineIndex; }
     
    8988    void expandHorizontally(InlineLayoutUnit delta) { m_rect.expandHorizontally(delta); }
    9089
    91     void setTextContext(const TextContext&& textContext) { m_textContext.emplace(textContext); }
    92     const Optional<TextContext>& textContext() const { return m_textContext; }
    93     Optional<TextContext>& textContext() { return m_textContext; }
     90    void setTextContent(const TextContent&& textContent) { m_textContent.emplace(textContent); }
     91    const Optional<TextContent>& textContent() const { return m_textContent; }
     92    Optional<TextContent>& textContent() { return m_textContent; }
    9493
    9594    struct Expansion {
     
    103102    CachedImage* image() const { return m_cachedImage; }
    104103
    105     bool isLineBreak() const { return layoutBox().isLineBreakBox() || (textContext() && textContext()->content() == "\n" && style().preserveNewline()); }
     104    // FIXME: This information should be preserved at Run construction time.
     105    bool isLineBreak() const { return layoutBox().isLineBreakBox() || (textContent() && textContent()->content() == "\n" && style().preserveNewline()); }
    106106
    107107    const Layout::Box& layoutBox() const { return *m_layoutBox; }
     
    116116    InlineRect m_inkOverflow;
    117117    Expansion m_expansion;
    118     Optional<TextContext> m_textContext;
     118    Optional<TextContent> m_textContent;
    119119};
    120120
    121 inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& rect, const InlineRect& inkOverflow, Expansion expansion, Optional<TextContext> textContext)
     121inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& rect, const InlineRect& inkOverflow, Expansion expansion, Optional<TextContent> textContent)
    122122    : m_lineIndex(lineIndex)
    123123    , m_layoutBox(makeWeakPtr(layoutBox))
     
    125125    , m_inkOverflow(inkOverflow)
    126126    , m_expansion(expansion)
    127     , m_textContext(textContext)
     127    , m_textContent(textContent)
    128128{
    129129}
    130130
    131 inline Run::TextContext::TextContext(unsigned start, unsigned length, const String& contentString)
     131inline Run::TextContent::TextContent(unsigned start, unsigned length, const String& contentString)
    132132    : m_start(start)
    133133    , m_length(length)
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r256431 r256437  
    486486            auto inkOverflow = computedInkOverflow();
    487487            lineInkOverflow.expandToContain(inkOverflow);
    488             inlineContent.runs.append({ lineIndex, lineRun.layoutBox(), logicalRect, inkOverflow, lineRun.expansion(), lineRun.textContext() });
     488            inlineContent.runs.append({ lineIndex, lineRun.layoutBox(), logicalRect, inkOverflow, lineRun.expansion(), lineRun.textContent() });
    489489        }
    490490
     
    544544    // Make sure the trailing text run gets a hyphen when it needs one.
    545545    if (lineContent.partialContent && lineContent.partialContent->trailingContentNeedsHyphen)
    546         inlineContent.runs[*lastTextItemIndex].textContext()->setNeedsHyphen();
     546        inlineContent.runs[*lastTextItemIndex].textContent()->setNeedsHyphen();
    547547    // FIXME: This is where the logical to physical translate should happen.
    548548    auto& baseline = lineBox.baseline();
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp

    r256431 r256437  
    751751    , m_layoutBox(&softLineBreakItem.layoutBox())
    752752    , m_logicalRect({ 0, logicalLeft, 0, 0 })
    753     , m_textContext({ softLineBreakItem.position(), 1, softLineBreakItem.inlineTextBox().content() })
     753    , m_textContent({ softLineBreakItem.position(), 1, softLineBreakItem.inlineTextBox().content() })
    754754{
    755755}
     
    760760    , m_logicalRect({ 0, logicalLeft, logicalWidth, 0 })
    761761    , m_trailingWhitespaceType(trailingWhitespaceType(inlineTextItem))
    762     , m_textContext({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length(), inlineTextItem.inlineTextBox().content() })
     762    , m_textContent({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length(), inlineTextItem.inlineTextBox().content() })
    763763{
    764764    if (m_trailingWhitespaceType != TrailingWhitespace::None) {
     
    782782        m_trailingWhitespaceWidth = { };
    783783        setExpansionBehavior(AllowLeadingExpansion | AllowTrailingExpansion);
    784         m_textContext->expand(inlineTextItem.length());
     784        m_textContent->expand(inlineTextItem.length());
    785785        return;
    786786    }
     
    789789        ++m_expansionOpportunityCount;
    790790    setExpansionBehavior(DefaultExpansion);
    791     m_textContext->expand(m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length());
     791    m_textContent->expand(m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length());
    792792}
    793793
     
    818818    // According to https://www.w3.org/TR/css-text-3/#white-space-property matrix
    819819    // Trimmable whitespace is always collapsable so the length of the trailing trimmable whitespace is always 1 (or non-existent).
    820     ASSERT(m_textContext->length());
    821     m_textContext->expand(-1);
     820    ASSERT(m_textContent->length());
     821    m_textContent->expand(-1);
    822822    visuallyCollapseTrailingWhitespace();
    823823}
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h

    r256431 r256437  
    8686        const Display::InlineRect& logicalRect() const { return m_logicalRect; }
    8787        Display::Run::Expansion expansion() const { return m_expansion; }
    88         const Optional<Display::Run::TextContext>& textContext() const { return m_textContext; }
     88        const Optional<Display::Run::TextContent>& textContent() const { return m_textContent; }
    8989
    9090        Run(Run&&) = default;
     
    138138        TrailingWhitespace m_trailingWhitespaceType { TrailingWhitespace::None };
    139139        InlineLayoutUnit m_trailingWhitespaceWidth { 0 };
    140         Optional<Display::Run::TextContext> m_textContext;
     140        Optional<Display::Run::TextContent> m_textContent;
    141141        Display::Run::Expansion m_expansion;
    142142        unsigned m_expansionOpportunityCount { 0 };
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r256431 r256437  
    268268
    269269    for (auto& run : inlineContent.runsForRect(paintRect)) {
    270         if (!run.textContext())
    271             continue;
    272 
    273         auto& textContext = *run.textContext();
    274         if (!textContext.length())
     270        if (!run.textContent())
     271            continue;
     272
     273        auto& textContent = *run.textContent();
     274        if (!textContent.length())
    275275            continue;
    276276
     
    295295
    296296        String textWithHyphen;
    297         if (textContext.needsHyphen())
    298             textWithHyphen = makeString(textContext.content(), style.hyphenString());
    299         TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
     297        if (textContent.needsHyphen())
     298            textWithHyphen = makeString(textContent.content(), style.hyphenString());
     299        TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
    300300        textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
    301301        FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baselineOffset, deviceScaleFactor) };
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r256417 r256437  
    342342            stream << " ";
    343343        stream << "  ";
    344         if (displayRun.textContext())
     344        if (displayRun.textContent())
    345345            stream << "inline text box";
    346346        else
    347347            stream << "inline box";
    348348        stream << " at (" << displayRun.left() << "," << displayRun.top() << ") size " << displayRun.width() << "x" << displayRun.height();
    349         if (displayRun.textContext())
    350             stream << " run(" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
     349        if (displayRun.textContent())
     350            stream << " run(" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")";
    351351        stream.nextLine();
    352352    }
  • trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h

    r255143 r256437  
    6868    }
    6969
    70     bool hasHyphen() const { return run().textContext()->needsHyphen(); }
    71     StringView text() const { return run().textContext()->content(); }
    72     unsigned localStartOffset() const { return run().textContext()->start(); }
    73     unsigned localEndOffset() const { return run().textContext()->end(); }
    74     unsigned length() const { return run().textContext()->length(); }
     70    bool hasHyphen() const { return run().textContent()->needsHyphen(); }
     71    StringView text() const { return run().textContent()->content(); }
     72    unsigned localStartOffset() const { return run().textContent()->start(); }
     73    unsigned localEndOffset() const { return run().textContent()->end(); }
     74    unsigned length() const { return run().textContent()->length(); }
    7575
    7676    bool isLastOnLine() const
Note: See TracChangeset for help on using the changeset viewer.