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

Changeset 284680 in webkit


Ignore:
Timestamp:
Oct 22, 2021, 7:31:05 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
https://bugs.webkit.org/show_bug.cgi?id=232055

Reviewed by Antti Koivisto.

Source/WebCore:

Due to the isWrappingAllowed checks in isAtSoftWrapOpportunity() to speed up line breaking,
we may end up with adjacent whitespace content with different wrapping styles (embedded in separate inline boxes).
e.g. <span style="white-space: no-wrap">XXX </span><span style="white-space: normal"> X</span

Test: fast/inline/white-space-nowrap-and-normal-inline-box.html

  • layout/formattingContexts/inline/InlineContentBreaker.cpp:

(WebCore::Layout::isVisuallyEmptyWhitespaceContent):

  • layout/formattingContexts/inline/InlineLineBuilder.cpp:

(WebCore::Layout::isAtSoftWrapOpportunity):

LayoutTests:

  • fast/inline/white-space-nowrap-and-normal-inline-box-expected.html: Added.
  • fast/inline/white-space-nowrap-and-normal-inline-box.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284677 r284680  
     12021-10-22  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
     4        https://bugs.webkit.org/show_bug.cgi?id=232055
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/inline/white-space-nowrap-and-normal-inline-box-expected.html: Added.
     9        * fast/inline/white-space-nowrap-and-normal-inline-box.html: Added.
     10
    1112021-10-22  Alan Bujtas  <zalan@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r284678 r284680  
     12021-10-22  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
     4        https://bugs.webkit.org/show_bug.cgi?id=232055
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Due to the isWrappingAllowed checks in isAtSoftWrapOpportunity() to speed up line breaking,
     9        we may end up with adjacent whitespace content with different wrapping styles (embedded in separate inline boxes).
     10        e.g. <span style="white-space: no-wrap">XXX </span><span style="white-space: normal"> X</span
     11
     12        Test: fast/inline/white-space-nowrap-and-normal-inline-box.html
     13
     14        * layout/formattingContexts/inline/InlineContentBreaker.cpp:
     15        (WebCore::Layout::isVisuallyEmptyWhitespaceContent):
     16        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
     17        (WebCore::Layout::isAtSoftWrapOpportunity):
     18
    1192021-10-22  Alan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

    r284452 r284680  
    9393        auto& currentInlineTextItem = downcast<InlineTextItem>(current);
    9494        auto& nextInlineTextItem = downcast<InlineTextItem>(next);
     95        if (currentInlineTextItem.isWhitespace() && nextInlineTextItem.isWhitespace()) {
     96            // <span> </span><span> </span>. Depending on the styles, there may or may not be a soft wrap opportunity between these 2 whitespace content.
     97            return TextUtil::isWrappingAllowed(currentInlineTextItem.style()) || TextUtil::isWrappingAllowed(nextInlineTextItem.style());
     98        }
    9599        if (currentInlineTextItem.isWhitespace()) {
    96             // [ ][text] : after [whitespace] position is a soft wrap opportunity.
     100            // " <span>text</span>" : after [whitespace] position is a soft wrap opportunity.
    97101            return TextUtil::isWrappingAllowed(currentInlineTextItem.style());
    98102        }
    99103        if (nextInlineTextItem.isWhitespace()) {
    100             // [text][ ] (<span>text</span> )
     104            // "<span>text</span> "
    101105            // white-space: break-spaces: line breaking opportunity exists after every preserved white space character, but not before.
    102106            return TextUtil::isWrappingAllowed(nextInlineTextItem.style()) && nextInlineTextItem.style().whiteSpace() != WhiteSpace::BreakSpaces;
Note: See TracChangeset for help on using the changeset viewer.