Title: [253151] trunk/Source/WebCore
Revision
253151
Author
[email protected]
Date
2019-12-05 09:11:19 -0800 (Thu, 05 Dec 2019)

Log Message

[LFC][IFC] Many render tree dump tests show 1px too narrow runs
https://bugs.webkit.org/show_bug.cgi?id=204885

Reviewed by Zalan Bujtas.

Width measurement is currently clamping the measured (float) text widths to layout units. Use rounding instead.

This doesn't solve the fundamental problem of loss of precision but it allows many more render tree dump
based layout tests to pass.

* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
(WebCore::Layout::TextUtil::fixedPitchWidth):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253150 => 253151)


--- trunk/Source/WebCore/ChangeLog	2019-12-05 15:33:54 UTC (rev 253150)
+++ trunk/Source/WebCore/ChangeLog	2019-12-05 17:11:19 UTC (rev 253151)
@@ -1,3 +1,19 @@
+2019-12-05  Antti Koivisto  <[email protected]>
+
+        [LFC][IFC] Many render tree dump tests show 1px too narrow runs
+        https://bugs.webkit.org/show_bug.cgi?id=204885
+
+        Reviewed by Zalan Bujtas.
+
+        Width measurement is currently clamping the measured (float) text widths to layout units. Use rounding instead.
+
+        This doesn't solve the fundamental problem of loss of precision but it allows many more render tree dump
+        based layout tests to pass.
+
+        * layout/inlineformatting/text/TextUtil.cpp:
+        (WebCore::Layout::TextUtil::width):
+        (WebCore::Layout::TextUtil::fixedPitchWidth):
+
 2019-12-05  youenn fablet  <[email protected]>
 
         inspector/page/overrideSetting-MockCaptureDevicesEnabled.html is failing after removal of internals.setMockMediaCaptureDevicesEnabled API

Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (253150 => 253151)


--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-05 15:33:54 UTC (rev 253150)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-05 17:11:19 UTC (rev 253151)
@@ -71,7 +71,7 @@
     if (measureWithEndSpace)
         width -= (font.spaceWidth() + font.wordSpacing());
 
-    return std::max(0_lu, LayoutUnit { width });
+    return std::max(0_lu, LayoutUnit::fromFloatRound(width));
 }
 
 LayoutUnit TextUtil::fixedPitchWidth(const StringView& text, const RenderStyle& style, unsigned from, unsigned to, LayoutUnit contentLogicalLeft)
@@ -90,7 +90,7 @@
             width += font.wordSpacing();
     }
 
-    return std::max(0_lu, LayoutUnit { width });
+    return std::max(0_lu, LayoutUnit::fromFloatRound(width));
 }
 
 TextUtil::SplitData TextUtil::split(const Box& inlineBox, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to