⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284683 in webkit


Ignore:
Timestamp:
Oct 22, 2021, 8:17:11 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
https://bugs.webkit.org/show_bug.cgi?id=232056

Reviewed by Antti Koivisto.

Source/WebCore:

See the comment in LineBuilder::handleInlineContent.

  • layout/formattingContexts/inline/InlineLineBuilder.cpp:

(WebCore::Layout::LineBuilder::handleInlineContent):

LayoutTests:

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284680 r284683  
     12021-10-22  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
     4        https://bugs.webkit.org/show_bug.cgi?id=232056
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * TestExpectations:
     9
    1102021-10-22  Alan Bujtas  <zalan@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r284658 r284683  
    25782578webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-016.html [ ImageOnlyFailure ]
    25792579webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-017.html [ ImageOnlyFailure ]
    2580 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-003.html [ ImageOnlyFailure ]
    25812580webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html [ ImageOnlyFailure ]
    25822581webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r284680 r284683  
     12021-10-22  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
     4        https://bugs.webkit.org/show_bug.cgi?id=232056
     5
     6        Reviewed by Antti Koivisto.
     7
     8        See the comment in LineBuilder::handleInlineContent.
     9
     10        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
     11        (WebCore::Layout::LineBuilder::handleInlineContent):
     12
    1132021-10-22  Alan Bujtas  <zalan@apple.com>
    214
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

    r284680 r284683  
    771771        for (auto& run : candidateRuns)
    772772            m_line.append(run.inlineItem, run.style, run.logicalWidth);
    773         if (lineCandidate.inlineContent.hasTrailingSoftWrapOpportunity()) {
    774             // Check if we are allowed to wrap at this position.
     773        // We are keeping this content on the line but we need to check if we could have wrapped here
     774        // in order to be able to revert back to this positon if needed.
     775        // Let's just ignore cases like collapsed leading whitespace for now.
     776        if (lineCandidate.inlineContent.hasTrailingSoftWrapOpportunity() && m_line.hasContent()) {
    775777            auto& trailingRun = candidateRuns.last();
    776             // FIXME: There must be a way to decide if the trailing run actually ended up on the line.
    777             // Let's just deal with collapsed leading whitespace for now.
    778             if (m_line.hasContent() && TextUtil::isWrappingAllowed(trailingRun.style))
    779                 m_wrapOpportunityList.append(&trailingRun.inlineItem);
     778            auto& trailingInlineItem = trailingRun.inlineItem;
     779            // Note that wrapping here could be driven both by the style of the parent and the inline item itself.
     780            // e.g inline boxes set the wrapping rules for their content and not for themselves.
     781            auto& parentStyle = trailingInlineItem.layoutBox().parent().style();
     782            auto isWrapOpportunity = TextUtil::isWrappingAllowed(parentStyle);
     783            if (!isWrapOpportunity && (trailingInlineItem.isInlineBoxStart() || trailingInlineItem.isInlineBoxEnd()))
     784                isWrapOpportunity = TextUtil::isWrappingAllowed(trailingRun.style);
     785            if (isWrapOpportunity)
     786                m_wrapOpportunityList.append(&trailingInlineItem);
    780787        }
    781788        return { result.isEndOfLine, { candidateRuns.size(), false } };
Note: See TracChangeset for help on using the changeset viewer.