Changeset 254425 in webkit


Ignore:
Timestamp:
Jan 13, 2020 2:11:00 AM (4 years ago)
Author:
Antti Koivisto
Message:

[LFC][IFC] fast/text/fast-run-width-vs-slow-run-width.html is failing
https://bugs.webkit.org/show_bug.cgi?id=206143

Reviewed by Zalan Bujtas.

The test is constructed so that the preferred width computation produces float value that maps exactly to LayoutUnit
(usually it gets ceiled up). This get converted back to float and the same input widths are substracted from
the total during inline layout. Due to nature of floating point arithmetic this ends up producing slightly
different result and the last word doesn't fit.

  • layout/inlineformatting/InlineLineBreaker.cpp:

(WebCore::Layout::LineBreaker::tryWrappingInlineContent const):

When using floats, do an additional equality comparison that accepts values within scaled float epsilon as equal.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r254421 r254425  
     12020-01-13  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][IFC] fast/text/fast-run-width-vs-slow-run-width.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=206143
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        The test is constructed so that the preferred width computation produces float value that maps exactly to LayoutUnit
     9        (usually it gets ceiled up). This get converted back to float and the same input widths are substracted from
     10        the total during inline layout. Due to nature of floating point arithmetic this ends up producing slightly
     11        different result and the last word doesn't fit.
     12
     13        * layout/inlineformatting/InlineLineBreaker.cpp:
     14        (WebCore::Layout::LineBreaker::tryWrappingInlineContent const):
     15
     16        When using floats, do an additional equality comparison that accepts values within scaled float epsilon as equal.
     17
    1182020-01-12  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp

    r254032 r254425  
    131131    if (candidateContent.width() <= lineStatus.availableWidth)
    132132        return { Result::Action::Keep };
     133
     134#if USE_FLOAT_AS_INLINE_LAYOUT_UNIT
     135    // Preferred width computation sums up floats while line breaker substracts them. This can lead to epsilon-scale differences.
     136    if (WTF::areEssentiallyEqual(candidateContent.width(), lineStatus.availableWidth))
     137        return { Result::Action::Keep };
     138#endif
     139
    133140    if (candidateContent.hasTrailingCollapsibleContent()) {
    134141        ASSERT(candidateContent.hasTextContentOnly());
Note: See TracChangeset for help on using the changeset viewer.