[Webkit-unassigned] [Bug 266869] New: Fix rounding of very large and very small LayoutUnits
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Dec 24 13:29:09 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=266869
Bug ID: 266869
Summary: Fix rounding of very large and very small LayoutUnits
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Layout and Rendering
Assignee: webkit-unassigned at lists.webkit.org
Reporter: ahmad.saleem792 at gmail.com
CC: bfulgham at webkit.org, simon.fraser at apple.com,
zalan at apple.com
Hi Team,
While looking into LayoutUnit.h code changes in Blink, I noticed that they fixed following bug:
Blink Commit - https://source.chromium.org/chromium/chromium/src/+/a7b04f8fe15406cbf98995da00fc63f73e9fff61
WebKit Source - https://github.com/WebKit/WebKit/blob/008483f2054324eb36aabbd31f58a59ffeff8da8/Source/WebCore/platform/LayoutUnit.h#L159
___
This compiles:
return toInt() + ((fraction().rawValue() + (kFixedPointDenominator / 2)) >> kLayoutUnitFractionalBits);
and
https://github.com/WebKit/WebKit/blob/008483f2054324eb36aabbd31f58a59ffeff8da8/Tools/TestWebKitAPI/Tests/WebCore/LayoutUnitTests.cpp#L84
Test (LayoutUnitRounding):
// The fractional part of LayoutUnit::Max() is 0x3f, so it should round up.
ASSERT_EQ(((std::numeric_limits<int>::max() / kFixedPointDenominator) + 1), LayoutUnit::max().round());
// The fractional part of LayoutUnit::Min() is 0, so the next bigger possible
// value should round down.
LayoutUnit epsilon;
epsilon.setRawValue(1);
ASSERT_EQ(((std::numeric_limits<int>::min() / kFixedPointDenominator)), (LayoutUnit::min() + epsilon).round());
}
___
Without change, running above test fails -> run-api-tests WebCoreLayoutUnit.LayoutUnitRounding
Ran 1 tests of 1 with 0 successful
------------------------------
Test suite failed
Failed
TestWebKitAPI.WebCoreLayoutUnit.LayoutUnitRounding
/Users/ahmadsaleem/Documents/GitHub-Webkit-Ahmad-Fork/Untitled/Tools/TestWebKitAPI/Tests/WebCore/LayoutUnitTests.cpp:108Expected equality of these values: ((std::numeric_limits<int>::max() / kFixedPointDenominator) + 1) Which is: 33554432 LayoutUnit::max().round() Which is: 33554431
___
Hence, I am raising so we can fix it.
Thanks!
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231224/0d86f6e7/attachment-0001.htm>
More information about the webkit-unassigned
mailing list