Changeset 270146 in webkit


Ignore:
Timestamp:
Nov 21, 2020 7:15:20 AM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][Integration] LayoutIntegration::Line::rect is way too ambiguous
https://bugs.webkit.org/show_bug.cgi?id=219230

Reviewed by Antti Koivisto.

Line::rect() is actually the line box (see https://www.w3.org/TR/css-inline-3/#line-box).

  • layout/integration/LayoutIntegrationLine.h:

(WebCore::LayoutIntegration::Line::lineBoxTop const):
(WebCore::LayoutIntegration::Line::lineBoxBottom const):
(WebCore::LayoutIntegration::Line::lineBoxLeft const):
(WebCore::LayoutIntegration::Line::lineBoxRight const):
(WebCore::LayoutIntegration::Line::rect const): Deleted.

  • layout/integration/LayoutIntegrationLineIteratorModernPath.h:

(WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxTop const):
(WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxBottom const):
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
(WebCore::LayoutIntegration::LineIteratorModernPath::logicalHeight const):

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const):
(WebCore::LayoutIntegration::LineLayout::firstLineBaseline const):
(WebCore::LayoutIntegration::LineLayout::lastLineBaseline const):
(WebCore::LayoutIntegration::LineLayout::adjustForPagination):
(WebCore::LayoutIntegration::LineLayout::paint):

  • layout/integration/LayoutIntegrationPagination.cpp:

(WebCore::LayoutIntegration::updateMinimumPageHeight):
(WebCore::LayoutIntegration::makeAdjustedContent):

  • layout/integration/LayoutIntegrationRunIteratorModernPath.h:

(WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270145 r270146  
     12020-11-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Integration] LayoutIntegration::Line::rect is way too ambiguous
     4        https://bugs.webkit.org/show_bug.cgi?id=219230
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Line::rect() is actually the line box (see https://www.w3.org/TR/css-inline-3/#line-box).
     9
     10        * layout/integration/LayoutIntegrationLine.h:
     11        (WebCore::LayoutIntegration::Line::lineBoxTop const):
     12        (WebCore::LayoutIntegration::Line::lineBoxBottom const):
     13        (WebCore::LayoutIntegration::Line::lineBoxLeft const):
     14        (WebCore::LayoutIntegration::Line::lineBoxRight const):
     15        (WebCore::LayoutIntegration::Line::rect const): Deleted.
     16        * layout/integration/LayoutIntegrationLineIteratorModernPath.h:
     17        (WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxTop const):
     18        (WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxBottom const):
     19        (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
     20        (WebCore::LayoutIntegration::LineIteratorModernPath::logicalHeight const):
     21        * layout/integration/LayoutIntegrationLineLayout.cpp:
     22        (WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const):
     23        (WebCore::LayoutIntegration::LineLayout::firstLineBaseline const):
     24        (WebCore::LayoutIntegration::LineLayout::lastLineBaseline const):
     25        (WebCore::LayoutIntegration::LineLayout::adjustForPagination):
     26        (WebCore::LayoutIntegration::LineLayout::paint):
     27        * layout/integration/LayoutIntegrationPagination.cpp:
     28        (WebCore::LayoutIntegration::updateMinimumPageHeight):
     29        (WebCore::LayoutIntegration::makeAdjustedContent):
     30        * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
     31        (WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const):
     32
    1332020-11-21  Zalan Bujtas  <zalan@apple.com>
    234
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h

    r270145 r270146  
    5656    size_t firstRunIndex() const { return m_firstRunIndex; }
    5757    size_t runCount() const { return m_runCount; }
    58     const FloatRect& rect() const { return m_lineBoxRect; }
     58
     59    float lineBoxTop() const { return m_lineBoxRect.y(); }
     60    float lineBoxBottom() const { return m_lineBoxRect.maxY(); }
     61    float lineBoxLeft() const { return m_lineBoxRect.x(); }
     62    float lineBoxRight() const { return m_lineBoxRect.maxX(); }
     63
    5964    float enclosingContentTop() const { return m_enclosingTopAndBottom.top; }
    6065    float enclosingContentBottom() const { return m_enclosingTopAndBottom.bottom; }
     66
    6167    const FloatRect& scrollableOverflow() const { return m_scrollableOverflow; }
    6268    const FloatRect& inkOverflow() const { return m_inkOverflow; }
     69
    6370    float baseline() const { return m_baseline; }
     71
    6472    float contentLeftOffset() const { return m_contentLeftOffset; }
    6573    float contentWidth() const { return m_contentWidth; }
     
    7078    // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box).
    7179    FloatRect m_lineBoxRect;
    72     // Enclosing top and bottom includes all inline level boxes (border box) vertically. In certain cases (see line-height property)
    73     // the line (and the line box) is not as tall as the inline level boxes on the line.
     80    // Enclosing top and bottom includes all inline level boxes (border box) vertically.
     81    // While the line box usually enclose them as well, its vertical geometry is based on
     82    // the layout bounds of the inline level boxes which may be different when line-height is present.
    7483    EnclosingTopAndBottom m_enclosingTopAndBottom;
    7584    FloatRect m_scrollableOverflow;
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h

    r270143 r270146  
    5252    LayoutUnit top() const { return LayoutUnit::fromFloatRound(line().enclosingContentTop()); }
    5353    LayoutUnit bottom() const { return LayoutUnit::fromFloatRound(line().enclosingContentBottom()); }
    54     LayoutUnit lineBoxTop() const { return LayoutUnit::fromFloatRound(line().rect().y()); }
    55     LayoutUnit lineBoxBottom() const { return LayoutUnit::fromFloatRound(line().rect().maxY()); }
     54    LayoutUnit lineBoxTop() const { return LayoutUnit::fromFloatRound(line().lineBoxTop()); }
     55    LayoutUnit lineBoxBottom() const { return LayoutUnit::fromFloatRound(line().lineBoxBottom()); }
    5656
    5757    // FIXME: What should these really be?
     
    6060    LayoutUnit selectionBottom() const { return bottom(); }
    6161
    62     float contentLogicalLeft() const { return line().rect().x() + line().contentLeftOffset(); }
     62    float contentLogicalLeft() const { return line().lineBoxLeft() + line().contentLeftOffset(); }
    6363    float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); }
    6464    float y() const { return lineBoxTop(); }
    65     float logicalHeight() const { return line().rect().height(); }
     65    float logicalHeight() const { return lineBoxBottom() - lineBoxTop(); }
    6666    bool isHorizontal() const { return true; }
    6767
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r270143 r270146  
    233233
    234234    auto& lines = m_inlineContent->lines;
    235     return LayoutUnit { lines.last().rect().maxY() - lines.first().rect().y() + m_inlineContent->clearGapAfterLastLine };
     235    return LayoutUnit { lines.last().lineBoxBottom() - lines.first().lineBoxTop() + m_inlineContent->clearGapAfterLastLine };
    236236}
    237237
     
    254254
    255255    auto& firstLine = m_inlineContent->lines.first();
    256     return LayoutUnit { firstLine.rect().y() + firstLine.baseline() };
     256    return LayoutUnit { firstLine.lineBoxTop() + firstLine.baseline() };
    257257}
    258258
     
    265265
    266266    auto& lastLine = m_inlineContent->lines.last();
    267     return LayoutUnit { lastLine.rect().y() + lastLine.baseline() };
     267    return LayoutUnit { lastLine.lineBoxTop() + lastLine.baseline() };
    268268}
    269269
     
    277277
    278278    auto& lines = paginedInlineContent->lines;
    279     m_paginatedHeight = LayoutUnit { lines.last().rect().maxY() - lines.first().rect().y() };
     279    m_paginatedHeight = LayoutUnit { lines.last().lineBoxBottom() - lines.first().lineBoxTop() };
    280280
    281281    m_inlineContent = WTFMove(paginedInlineContent);
     
    412412
    413413        auto& line = inlineContent.lineForRun(run);
    414         auto baseline = paintOffset.y() + line.rect().y() + line.baseline();
     414        auto baseline = paintOffset.y() + line.lineBoxTop() + line.baseline();
    415415        auto expansion = run.expansion();
    416416        // TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned
    417417        // and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px).
    418         auto xPos = rect.x() - (line.rect().x() + line.contentLeftOffset());
     418        auto xPos = rect.x() - (line.lineBoxLeft() + line.contentLeftOffset());
    419419        WebCore::TextRun textRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
    420420        textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp

    r270145 r270146  
    115115    auto orphans = style.hasAutoOrphans() ? 1 : std::max<int>(style.orphans(), 1);
    116116    auto minimumLineCount = std::min<unsigned>(std::max(widows, orphans), lineCount);
    117     flow.updateMinimumPageHeight(0, LayoutUnit(inlineContent.lines[minimumLineCount - 1].rect().maxY()));
     117    flow.updateMinimumPageHeight(0, LayoutUnit(inlineContent.lines[minimumLineCount - 1].lineBoxBottom()));
    118118}
    119119
     
    130130            line.firstRunIndex(),
    131131            line.runCount(),
    132             moveVertically(line.rect(), offset),
     132            moveVertically({ FloatPoint { line.lineBoxLeft(), line.lineBoxTop() }, FloatPoint { line.lineBoxRight(), line.lineBoxBottom() } }, offset),
    133133            { line.enclosingContentTop() + offset, line.enclosingContentBottom() + offset },
    134134            moveVertically(line.scrollableOverflow(), offset),
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h

    r270143 r270146  
    222222        auto expansion = run().expansion();
    223223        auto rect = this->rect();
    224         auto xPos = rect.x() - (line().rect().x() + line().contentLeftOffset());
     224        auto xPos = rect.x() - (line().lineBoxLeft() + line().contentLeftOffset());
    225225
    226226        auto textForRun = [&] {
Note: See TracChangeset for help on using the changeset viewer.