WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
266869
Fix rounding of very large and very small LayoutUnits
https://bugs.webkit.org/show_bug.cgi?id=266869
Summary
Fix rounding of very large and very small LayoutUnits
Ahmad Saleem
Reported
2023-12-24 13:29:09 PST
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!
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2023-12-24 20:54:26 PST
PR -
https://github.com/WebKit/WebKit/pull/22236
(Still draft to see if there are any other test failures)
EWS
Comment 2
2023-12-29 21:43:10 PST
Committed
272534@main
(2afefe7449cd): <
https://commits.webkit.org/272534@main
> Reviewed commits have been landed. Closing PR #22236 and removing active labels.
Radar WebKit Bug Importer
Comment 3
2023-12-29 21:44:13 PST
<
rdar://problem/120285542
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug