mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
LibWeb: Make CSSPixels and Length use 64-bit (double) floating point
This fixes a plethora of rounding problems on many websites. In the future, we may want to replace this with fixed-point arithmetic (bug #18566) for performance (and consistency with other engines), but in the meantime this makes the web look a bit better. :^) There's a lot more things that could be converted to doubles, which would reduce the amount of casting necessary in this patch. We can do that incrementally, however.
This commit is contained in:
parent
30262d7023
commit
655d9d1462
80 changed files with 298 additions and 299 deletions
|
@ -105,12 +105,11 @@ CSSPixelRect Page::device_to_css_rect(DevicePixelRect rect) const
|
|||
DevicePixelRect Page::enclosing_device_rect(CSSPixelRect rect) const
|
||||
{
|
||||
auto scale = client().device_pixels_per_css_pixel();
|
||||
return {
|
||||
floorf(rect.x().value() * scale),
|
||||
floorf(rect.y().value() * scale),
|
||||
ceilf(rect.width().value() * scale),
|
||||
ceilf(rect.height().value() * scale)
|
||||
};
|
||||
return DevicePixelRect(
|
||||
floor(rect.x().value() * scale),
|
||||
floor(rect.y().value() * scale),
|
||||
ceil(rect.width().value() * scale),
|
||||
ceil(rect.height().value() * scale));
|
||||
}
|
||||
|
||||
DevicePixelRect Page::rounded_device_rect(CSSPixelRect rect) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue