Changeset 270143 in webkit


Ignore:
Timestamp:
Nov 21, 2020 4:56:46 AM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][Integration] Add contentLogicalOffset and contentLogicalWidth to InlineLineGeometry(Line)
https://bugs.webkit.org/show_bug.cgi?id=219220

Reviewed by Antti Koivisto.

This helps to match the legacy root inline box's geometry where
line left + content offset == root inline box left edge
line left + content offset + content width = root inline box right edge

  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):

  • layout/inlineformatting/InlineLineGeometry.h:

(WebCore::Layout::InlineLineGeometry::contentOffset const):
(WebCore::Layout::InlineLineGeometry::contentWidth const):
(WebCore::Layout::InlineLineGeometry::InlineLineGeometry):
(WebCore::Layout::InlineLineGeometry::horizontalAlignmentOffset const): Deleted.

  • layout/integration/LayoutIntegrationInlineContentBuilder.cpp:

(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):

  • layout/integration/LayoutIntegrationLine.h:

(WebCore::LayoutIntegration::Line::Line):
(WebCore::LayoutIntegration::Line::contentOffset const):
(WebCore::LayoutIntegration::Line::contentWidth const):
(WebCore::LayoutIntegration::Line::horizontalAlignmentOffset const): Deleted.

  • layout/integration/LayoutIntegrationLineIteratorModernPath.h:

(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const):

  • layout/integration/LayoutIntegrationLineLayout.cpp:

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

  • layout/integration/LayoutIntegrationPagination.cpp:

(WebCore::LayoutIntegration::makeAdjustedContent):

  • layout/integration/LayoutIntegrationRunIteratorModernPath.h:

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

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270142 r270143  
     12020-11-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Integration] Add contentLogicalOffset and contentLogicalWidth to InlineLineGeometry(Line)
     4        https://bugs.webkit.org/show_bug.cgi?id=219220
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This helps to match the legacy root inline box's geometry where
     9        line left + content offset == root inline box left edge
     10        line left + content offset + content width = root inline box right edge
     11
     12        * layout/inlineformatting/InlineFormattingContext.cpp:
     13        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
     14        * layout/inlineformatting/InlineLineGeometry.h:
     15        (WebCore::Layout::InlineLineGeometry::contentOffset const):
     16        (WebCore::Layout::InlineLineGeometry::contentWidth const):
     17        (WebCore::Layout::InlineLineGeometry::InlineLineGeometry):
     18        (WebCore::Layout::InlineLineGeometry::horizontalAlignmentOffset const): Deleted.
     19        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
     20        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
     21        * layout/integration/LayoutIntegrationLine.h:
     22        (WebCore::LayoutIntegration::Line::Line):
     23        (WebCore::LayoutIntegration::Line::contentOffset const):
     24        (WebCore::LayoutIntegration::Line::contentWidth const):
     25        (WebCore::LayoutIntegration::Line::horizontalAlignmentOffset const): Deleted.
     26        * layout/integration/LayoutIntegrationLineIteratorModernPath.h:
     27        (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
     28        (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const):
     29        * layout/integration/LayoutIntegrationLineLayout.cpp:
     30        (WebCore::LayoutIntegration::LineLayout::paint):
     31        * layout/integration/LayoutIntegrationPagination.cpp:
     32        (WebCore::LayoutIntegration::makeAdjustedContent):
     33        * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
     34        (WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const):
     35
    1362020-11-21  Jiewen Tan  <jiewen_tan@apple.com>
    237
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r269989 r270143  
    494494
    495495    auto constructLineGeometry = [&] {
    496         formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }) });
     496        formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth });
    497497    };
    498498    constructLineGeometry();
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp

    r270135 r270143  
    156156    auto& runs = lineContent.runs;
    157157    auto lineLogicalWidth = lineContent.lineLogicalWidth;
    158     auto contentLogicalWidth = lineContent.lineContentLogicalWidth;
     158    auto contentLogicalWidth = lineContent.contentLogicalWidth;
    159159    auto isLineConsideredEmpty = lineContent.isLineConsideredEmpty ? LineBox::IsLineConsideredEmpty::Yes : LineBox::IsLineConsideredEmpty::No;
    160160    auto lineBox = LineBox { lineContent.logicalTopLeft, contentLogicalWidth, isLineConsideredEmpty };
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h

    r270114 r270143  
    6060        InlineLayoutPoint logicalTopLeft;
    6161        InlineLayoutUnit lineLogicalWidth;
    62         InlineLayoutUnit lineContentLogicalWidth;
     62        InlineLayoutUnit contentLogicalWidth;
    6363        bool isLineConsideredEmpty { true };
    6464        bool isLastLineWithInlineContent { true };
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h

    r269571 r270143  
    3636    WTF_MAKE_FAST_ALLOCATED;
    3737public:
    38     InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset);
     38    InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth);
    3939
    4040    InlineLayoutUnit logicalLeft() const { return logicalRect().left(); };
     
    5151
    5252    InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
    53     InlineLayoutUnit horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
     53
     54    InlineLayoutUnit contentLogicalLeftOffset() const { return m_contentLogicalLeftOffset; }
     55    InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
    5456
    5557    void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
     
    5961    InlineLayoutSize m_lineBoxLogicalSize;
    6062    InlineLayoutUnit m_aligmentBaseline { 0 };
    61     InlineLayoutUnit m_horizontalAlignmentOffset { 0 };
     63    InlineLayoutUnit m_contentLogicalLeftOffset { 0 };
     64    InlineLayoutUnit m_contentLogicalWidth { 0 };
    6265};
    6366
    64 inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset)
     67inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth)
    6568    : m_logicalRect(lineLogicalRect)
    6669    , m_lineBoxLogicalSize(lineBoxLogicalSize)
    6770    , m_aligmentBaseline(aligmentBaseline)
    68     , m_horizontalAlignmentOffset(horizontalAlignmentOffset)
     71    , m_contentLogicalLeftOffset(contentLogicalLeftOffset)
     72    , m_contentLogicalWidth(contentLogicalWidth)
    6973{
    7074}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp

    r269989 r270143  
    345345            enclosingTopAndBottom.bottom = roundToInt(enclosingTopAndBottom.bottom);
    346346        }
    347         inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.horizontalAlignmentOffset() });
     347        inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeftOffset(), line.contentLogicalWidth() });
    348348    }
    349349}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h

    r269989 r270143  
    4141        float bottom { 0 };
    4242    };
    43     Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float horizontalAlignmentOffset)
     43    Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeftOffset, float contentWidth)
    4444        : m_firstRunIndex(firstRunIndex)
    4545        , m_runCount(runCount)
     
    5050        , m_inkOverflow(inkOverflow)
    5151        , m_baseline(baseline)
    52         , m_horizontalAlignmentOffset(horizontalAlignmentOffset)
     52        , m_contentLeftOffset(contentLeftOffset)
     53        , m_contentWidth(contentWidth)
    5354    {
    5455    }
     
    6364    const FloatRect& inkOverflow() const { return m_inkOverflow; }
    6465    float baseline() const { return m_baseline; }
    65     float horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
     66    float contentLeftOffset() const { return m_contentLeftOffset; }
     67    float contentWidth() const { return m_contentWidth; }
    6668
    6769private:
     
    7880    FloatRect m_inkOverflow;
    7981    float m_baseline { 0 };
    80     float m_horizontalAlignmentOffset { 0 };
     82    float m_contentLeftOffset { 0 };
     83    float m_contentWidth { 0 };
    8184};
    8285
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h

    r270128 r270143  
    6060    LayoutUnit selectionBottom() const { return bottom(); }
    6161
    62     float contentLogicalLeft() const { return line().rect().x() + line().horizontalAlignmentOffset(); }
    63     float contentLogicalRight() const { return contentLogicalLeft() + line().rect().width(); }
     62    float contentLogicalLeft() const { return line().rect().x() + line().contentLeftOffset(); }
     63    float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); }
    6464    float y() const { return lineBoxTop(); }
    6565    float logicalHeight() const { return line().rect().height(); }
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r270119 r270143  
    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.horizontalAlignmentOffset());
     418        auto xPos = rect.x() - (line.rect().x() + 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

    r269989 r270143  
    136136            moveVertically(line.inkOverflow(), offset),
    137137            line.baseline(),
    138             line.horizontalAlignmentOffset()
     138            line.contentLeftOffset(),
     139            line.contentWidth()
    139140        };
    140141    };
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h

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