mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:37:35 +00:00
LibWeb: Add CSSPixels::nearest_value_for(FloatingPoint)
This is intended to annotate conversions from unknown floating-point values to CSSPixels, and make it more obvious the fp value will be rounded to the nearest fixed-point value.
This commit is contained in:
parent
360c0eb509
commit
71baa8c31a
28 changed files with 120 additions and 112 deletions
|
@ -1085,7 +1085,7 @@ void Element::set_scroll_left(double x)
|
|||
// 11. Scroll the element to x,scrollTop, with the scroll behavior being "auto".
|
||||
// FIXME: Implement this in terms of calling "scroll the element".
|
||||
auto scroll_offset = paintable_box()->scroll_offset();
|
||||
scroll_offset.set_x(CSSPixels(x));
|
||||
scroll_offset.set_x(CSSPixels::nearest_value_for(x));
|
||||
paintable_box()->set_scroll_offset(scroll_offset);
|
||||
}
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ void Element::set_scroll_top(double y)
|
|||
// 11. Scroll the element to scrollLeft,y, with the scroll behavior being "auto".
|
||||
// FIXME: Implement this in terms of calling "scroll the element".
|
||||
auto scroll_offset = paintable_box()->scroll_offset();
|
||||
scroll_offset.set_y(CSSPixels(y));
|
||||
scroll_offset.set_y(CSSPixels::nearest_value_for(y));
|
||||
paintable_box()->set_scroll_offset(scroll_offset);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue