Commit Graph

12 Commits

Author SHA1 Message Date
Bastiaan van der Plaat
c069ab1ca0 LibWeb: Refactor int types in WebContentServer to DevicePixels 2023-12-15 17:01:16 +01:00
Hendiadyoin1
cc74083f27 LibWeb: Inline and constexpr most PixelUnits methods 2023-08-05 20:03:09 +02:00
Hendiadyoin1
1e5ba09d76 LibWeb: Saturate PixelUnits on creation when needed 2023-08-05 20:03:09 +02:00
Hendiadyoin1
95d00553c9 LibWeb: Use default comparator for PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
71f56d8697 LibWeb: Saturate result in PixelUnits::operator/ 2023-08-05 20:03:09 +02:00
Hendiadyoin1
f9fc0505fb LibWeb: Add propper rounding to PixelUnits::operator*
Also moves related constants into the class to make them accessible for
tests.
2023-08-05 20:03:09 +02:00
Hendiadyoin1
4896ba11dc LibWeb: Use Checked::saturating_[add|sub] where applicable in PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
618f889486 LibWeb: Add and use convinient from_raw helper in PixelUnits 2023-08-05 20:03:09 +02:00
Aliaksandr Kalenik
2bd7d1426b LibWeb: Remove unused CSSPixels::epsilon() 2023-08-04 19:00:02 +02:00
Andi Gallo
e9ad8d5e4f LibWeb: Use i64 for intermediate value in CSSPixels multiplication
Reduce the chance of overflow due to fixed point denominator being
squared when multiplying the raw values, before adjusting the final
value back.
2023-08-04 13:36:29 +02:00
Aliaksandr Kalenik
c431167736 LibWeb: Implement subtraction using saturated_addition in CSSPixels
Fixes overflow bug found by UBSAN.
2023-07-25 15:21:40 +02:00
Aliaksandr Kalenik
bec07d4af7 LibWeb: Use fixed-point saturated arithmetics for CSSPixels
Using fixed-point saturated arithmetics for CSSPixels allows to avoid
accumulating floating-point errors.

This implementation is not complete yet: currently saturated
arithmetics implemented only for addition. But it is enough to not
regress any of layout tests we have :)

See https://github.com/SerenityOS/serenity/issues/18566
2023-07-25 11:52:02 +02:00