Changeset 270153 in webkit


Ignore:
Timestamp:
Nov 21, 2020 12:46:25 PM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Move current logicalLeft from ContinuousContent to LineStatus
https://bugs.webkit.org/show_bug.cgi?id=219237

Reviewed by Antti Koivisto.

Retain the content logical right in the LineStatus instead (this is used to measure text properly (see xPos) while finding hyphen position).

  • layout/inlineformatting/InlineContentBreaker.cpp:

(WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const):
(WebCore::Layout::InlineContentBreaker::ContinuousContent::reset):

  • layout/inlineformatting/InlineContentBreaker.h:

(WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalWidth const):
(WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalLeft const): Deleted.

  • layout/inlineformatting/InlineLineBuilder.cpp:

(WebCore::Layout::LineCandidate::InlineContent::reset):
(WebCore::Layout::LineCandidate::reset):
(WebCore::Layout::LineBuilder::nextContentForLine):
(WebCore::Layout::LineBuilder::handleFloatsAndInlineContent):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270152 r270153  
     12020-11-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Move current logicalLeft from ContinuousContent to LineStatus
     4        https://bugs.webkit.org/show_bug.cgi?id=219237
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Retain the content logical right in the LineStatus instead (this is used to measure text properly (see xPos) while finding hyphen position).
     9
     10        * layout/inlineformatting/InlineContentBreaker.cpp:
     11        (WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const):
     12        (WebCore::Layout::InlineContentBreaker::ContinuousContent::reset):
     13        * layout/inlineformatting/InlineContentBreaker.h:
     14        (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalWidth const):
     15        (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalLeft const): Deleted.
     16        * layout/inlineformatting/InlineLineBuilder.cpp:
     17        (WebCore::Layout::LineCandidate::InlineContent::reset):
     18        (WebCore::Layout::LineCandidate::reset):
     19        (WebCore::Layout::LineBuilder::nextContentForLine):
     20        (WebCore::Layout::LineBuilder::handleFloatsAndInlineContent):
     21
    1222020-11-21  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp

    r269535 r270153  
    275275            // When the first span computes longer than the available space, by the time we get to the second span, the adjusted available space becomes negative.
    276276            auto adjustedAvailableWidth = std::max<InlineLayoutUnit>(0, lineStatus.availableWidth - accumulatedRunWidth);
    277             if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft() + accumulatedRunWidth, adjustedAvailableWidth)) {
     277            if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, adjustedAvailableWidth)) {
    278278                if (partialRun->length)
    279279                    return TrailingTextContent { index, false, partialRun };
     
    297297        if (isBreakableRun(run)) {
    298298            ASSERT(run.inlineItem.isText());
    299             if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft() + accumulatedRunWidth, maxInlineLayoutUnit())) {
     299            if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, maxInlineLayoutUnit())) {
    300300                // We know this run fits, so if wrapping is allowed on the run, it should return a non-empty left-side.
    301301                ASSERT(partialRun->length);
     
    413413}
    414414
    415 void InlineContentBreaker::ContinuousContent::reset(InlineLayoutUnit contentLogicalLeft)
    416 {
    417     m_logicalLeft = contentLogicalLeft;
     415void InlineContentBreaker::ContinuousContent::reset()
     416{
    418417    m_logicalWidth = { };
    419418    m_collapsibleLogicalWidth = { };
  • trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h

    r267946 r270153  
    8080    struct ContinuousContent {
    8181        InlineLayoutUnit logicalWidth() const { return m_logicalWidth; }
    82         InlineLayoutUnit logicalLeft() const { return m_logicalLeft; }
    8382        InlineLayoutUnit collapsibleLogicalWidth() const { return m_collapsibleLogicalWidth; }
    8483        InlineLayoutUnit nonCollapsibleLogicalWidth() const { return logicalWidth() - collapsibleLogicalWidth(); }
     
    8786
    8887        void append(const InlineItem&, InlineLayoutUnit logicalWidth, Optional<InlineLayoutUnit> collapsibleWidth);
    89         void reset(InlineLayoutUnit contentLogicalLeft);
     88        void reset();
    9089
    9190        struct Run {
     
    102101    private:
    103102        RunList m_runs;
    104         InlineLayoutUnit m_logicalLeft { 0 };
    105103        InlineLayoutUnit m_logicalWidth { 0 };
    106104        InlineLayoutUnit m_collapsibleLogicalWidth { 0 };
     
    108106
    109107    struct LineStatus {
     108        InlineLayoutUnit contentLogicalRight { 0 };
    110109        InlineLayoutUnit availableWidth { 0 };
    111110        InlineLayoutUnit collapsibleWidth { 0 };
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp

    r270151 r270153  
    125125    LineCandidate(bool ignoreTrailingLetterSpacing);
    126126
    127     void reset(InlineLayoutUnit contentLogicalLeft);
     127    void reset();
    128128
    129129    struct InlineContent {
     
    137137        void appendTrailingLineBreak(const InlineItem& lineBreakItem) { m_trailingLineBreak = &lineBreakItem; }
    138138        void appendtrailingWordBreakOpportunity(const InlineItem& wordBreakItem) { m_trailingWordBreakOpportunity = &wordBreakItem; }
    139         void reset(InlineLayoutUnit contentLogicalLeft);
     139        void reset();
    140140
    141141    private:
     
    203203}
    204204
    205 inline void LineCandidate::InlineContent::reset(InlineLayoutUnit contentLogicalLeft)
    206 {
    207     m_continuousContent.reset(contentLogicalLeft);
     205inline void LineCandidate::InlineContent::reset()
     206{
     207    m_continuousContent.reset();
    208208    m_trailingLineBreak = { };
    209209    m_trailingWordBreakOpportunity = { };
     
    223223}
    224224
    225 inline void LineCandidate::reset(InlineLayoutUnit contentLogicalLeft)
     225inline void LineCandidate::reset()
    226226{
    227227    floatContent.reset();
    228     inlineContent.reset(contentLogicalLeft);
     228    inlineContent.reset();
    229229}
    230230
     
    455455{
    456456    ASSERT(currentInlineItemIndex < layoutRange.end);
    457     lineCandidate.reset(currentLogicalRight);
     457    lineCandidate.reset();
    458458    // 1. Simply add any overflow content from the previous line to the candidate content. It's always a text content.
    459459    // 2. Find the next soft wrap position or explicit line break.
     
    608608    auto availableWidth = this->availableWidth() - floatContent.intrusiveWidth();
    609609    auto isLineConsideredEmpty = m_line.isConsideredEmpty() && !m_contentIsConstrainedByFloat;
    610     auto lineStatus = InlineContentBreaker::LineStatus { availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
     610    auto lineStatus = InlineContentBreaker::LineStatus { m_line.contentLogicalWidth(), availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
    611611    auto result = inlineContentBreaker.processInlineContent(continuousInlineContent, lineStatus);
    612612    if (result.lastWrapOpportunityItem)
Note: See TracChangeset for help on using the changeset viewer.