mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibWeb: Add propper rounding to PixelUnits::operator*
Also moves related constants into the class to make them accessible for tests.
This commit is contained in:
parent
4896ba11dc
commit
f9fc0505fb
3 changed files with 36 additions and 6 deletions
|
@ -52,6 +52,11 @@ constexpr DevicePixels operator%(DevicePixels left, T right) { return left.value
|
|||
/// See https://www.w3.org/TR/css-values-3/#reference-pixel
|
||||
class CSSPixels {
|
||||
public:
|
||||
static constexpr i32 fractional_bits = 6;
|
||||
static constexpr i32 fixed_point_denominator = 1 << fractional_bits;
|
||||
|
||||
static constexpr i32 radix_mask = fixed_point_denominator - 1;
|
||||
|
||||
CSSPixels() = default;
|
||||
CSSPixels(int value);
|
||||
CSSPixels(unsigned int value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue