Title: [254425] trunk/Source/WebCore
Revision
254425
Author
[email protected]
Date
2020-01-13 02:11:00 -0800 (Mon, 13 Jan 2020)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (254424 => 254425)


--- trunk/Source/WebCore/ChangeLog	2020-01-13 09:31:24 UTC (rev 254424)
+++ trunk/Source/WebCore/ChangeLog	2020-01-13 10:11:00 UTC (rev 254425)
@@ -1,3 +1,20 @@
+2020-01-13  Antti Koivisto  <[email protected]>
+
+        [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.
+
 2020-01-12  Zalan Bujtas  <[email protected]>
 
         Text-indent with percentage value should resolve against the available width

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (254424 => 254425)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2020-01-13 09:31:24 UTC (rev 254424)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2020-01-13 10:11:00 UTC (rev 254425)
@@ -130,6 +130,13 @@
 {
     if (candidateContent.width() <= lineStatus.availableWidth)
         return { Result::Action::Keep };
+
+#if USE_FLOAT_AS_INLINE_LAYOUT_UNIT
+    // Preferred width computation sums up floats while line breaker substracts them. This can lead to epsilon-scale differences.
+    if (WTF::areEssentiallyEqual(candidateContent.width(), lineStatus.availableWidth))
+        return { Result::Action::Keep };
+#endif
+
     if (candidateContent.hasTrailingCollapsibleContent()) {
         ASSERT(candidateContent.hasTextContentOnly());
         auto IsEndOfLine = isContentWrappingAllowed(candidateContent) ? IsEndOfLine::Yes : IsEndOfLine::No;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to