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

Changeset 283440 in webkit


Ignore:
Timestamp:
Oct 2, 2021, 6:34:43 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Do not reuse the overflowing width on the next line when first line style is different
https://bugs.webkit.org/show_bug.cgi?id=231107

Reviewed by Antti Koivisto.

Let's compute the leading text content width at the next line (instead of reusing the overflowing trailing width), when the first line style is present and font-cascades differ.

  • layout/formattingContexts/inline/InlineLineBuilder.cpp:

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

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r283439 r283440  
     12021-10-02  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Do not reuse the overflowing width on the next line when first line style is different
     4        https://bugs.webkit.org/show_bug.cgi?id=231107
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Let's compute the leading text content width at the next line (instead of reusing the overflowing trailing width), when the first line style is present and font-cascades differ.
     9
     10        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
     11        (WebCore::Layout::LineBuilder::handleInlineContent):
     12
    1132021-10-02  Ziran Sun  <zsun@igalia.com>
    214
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

    r283275 r283440  
    726726        if (inlineTextItem.isWhitespace())
    727727            return { };
     728        auto& overflowingRun = candidateRuns.first();
     729        if (m_isFirstLine) {
     730            auto& usedStyle = overflowingRun.style;
     731            auto& style = overflowingRun.inlineItem.style();
     732            if (&usedStyle != &style && usedStyle.fontCascade() != style.fontCascade()) {
     733                // We may have the incorrect text width when styles differ. Just re-measure the text content when we place it on the next line.
     734                return { };
     735            }
     736        }
     737        auto logicalWidthForNextLineAsLeading = overflowingRun.logicalWidth;
    728738        if (result.action == InlineContentBreaker::Result::Action::Wrap)
    729             return candidateRuns.first().logicalWidth;
     739            return logicalWidthForNextLineAsLeading;
    730740        if (result.action == InlineContentBreaker::Result::Action::Break && result.partialTrailingContent->partialRun)
    731             return candidateRuns.first().logicalWidth - result.partialTrailingContent->partialRun->logicalWidth;
     741            return logicalWidthForNextLineAsLeading - result.partialTrailingContent->partialRun->logicalWidth;
    732742        return { };
    733743    };
Note: See TracChangeset for help on using the changeset viewer.