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

Changeset 267617 in webkit


Ignore:
Timestamp:
Sep 25, 2020, 10:21:18 PM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Incorrect breaking position when inline box content fits the line but the inline content itself does not.
https://bugs.webkit.org/show_bug.cgi?id=217007

Reviewed by Simon Fraser.

Source/WebCore:

When the inline box does not fit the line but its text content does, the last breaking opportunity (in case of arbitrary breaking position)
is not the end of the text.
e.g
<div style="width: 200px; word-break: break-word;"><span style="border-right: 100px;">text_content_fits</span></div>
in this case the border right overflows the containing block and should be wrapped to the next available vertical position.
However the last breaking opportunity is not between 's' and the </span> but between 't' and 's'.

Test: fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not.html

  • layout/inlineformatting/InlineLineBreaker.cpp:

(WebCore::Layout::LineBreaker::tryBreakingTextRun const):

  • layout/inlineformatting/InlineLineBuilder.cpp:

(WebCore::Layout::LineCandidate::InlineContent::appendInlineItem): [container start](<span>) and [container end](</span>) runs are not collapsible.

LayoutTests:

  • fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not-expected.html: Added.
  • fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267616 r267617  
     12020-09-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Incorrect breaking position when inline box content fits the line but the inline content itself does not.
     4        https://bugs.webkit.org/show_bug.cgi?id=217007
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not-expected.html: Added.
     9        * fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not.html: Added.
     10
    1112020-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r267616 r267617  
     12020-09-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Incorrect breaking position when inline box content fits the line but the inline content itself does not.
     4        https://bugs.webkit.org/show_bug.cgi?id=217007
     5
     6        Reviewed by Simon Fraser.
     7
     8        When the inline box does not fit the line but its text content does, the last breaking opportunity (in case of arbitrary breaking position)
     9        is not the end of the text.
     10        e.g
     11        <div style="width: 200px; word-break: break-word;"><span style="border-right: 100px;">text_content_fits</span></div>
     12        in this case the border right overflows the containing block and should be wrapped to the next available vertical position.
     13        However the last breaking opportunity is not between 's' and the </span> but between 't' and 's'.
     14
     15        Test: fast/layoutformattingcontext/inlin-box-content-fits-but-the-box-does-not.html
     16
     17        * layout/inlineformatting/InlineLineBreaker.cpp:
     18        (WebCore::Layout::LineBreaker::tryBreakingTextRun const):
     19        * layout/inlineformatting/InlineLineBuilder.cpp:
     20        (WebCore::Layout::LineCandidate::InlineContent::appendInlineItem): [container start](<span>) and [container end](</span>) runs are not collapsible.
     21
    1222020-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
    223
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp

    r267494 r267617  
    302302            // When the run can be split at arbitrary position,
    303303            // let's just return the entire run when it is intended to fit on the line.
    304             return PartialRun { inlineTextItem.length(), overflowRun.logicalWidth, false };
     304            ASSERT(inlineTextItem.length());
     305            auto trailingPartialRunWidth = TextUtil::width(inlineTextItem, inlineTextItem.start(), inlineTextItem.end() - 1, logicalLeft);
     306            return PartialRun { inlineTextItem.length() - 1, trailingPartialRunWidth, false };
    305307        }
    306308        auto splitData = TextUtil::split(inlineTextItem.inlineTextBox(), inlineTextItem.start(), inlineTextItem.length(), overflowRun.logicalWidth, availableWidth, logicalLeft);
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp

    r267515 r267617  
    248248            return inlineTextItem.isWhitespace() && !TextUtil::shouldPreserveTrailingWhitespace(inlineTextItem.style());
    249249        }
     250        if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
     251            return false;
     252        ASSERT_NOT_REACHED();
    250253        return true;
    251254    };
Note: See TracChangeset for help on using the changeset viewer.