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:
MacDue 2023-08-26 15:57:31 +01:00 committed by Alexander Kalenik
commit 71baa8c31a
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00
28 changed files with 120 additions and 112 deletions

View file

@ -1245,7 +1245,7 @@ void GridFormattingContext::expand_flexible_tracks(AvailableSpace const& availab
for (auto& track : tracks) {
if (track.max_track_sizing_function.is_flexible_length()) {
if (track.max_track_sizing_function.flex_factor() > 1) {
result = max(result, CSSPixels(track.base_size / track.max_track_sizing_function.flex_factor()));
result = max(result, CSSPixels::nearest_value_for(track.base_size / track.max_track_sizing_function.flex_factor()));
} else {
result = max(result, track.base_size);
}