1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

LibWeb: Add Length::resolved() overload for CSSPixels

Since we always pass the px value as an argument to resolved(), we can
pass it directly as CSSPixels instead of wrapping it in Length. This
approach allows us to avoid converting to a double, resulting in fewer
precision issues.
This commit is contained in:
Aliaksandr Kalenik 2023-08-29 18:57:09 +02:00 committed by Alexander Kalenik
parent 5eb0f65cc0
commit 0fb571c1c2
14 changed files with 154 additions and 75 deletions

View file

@ -842,9 +842,7 @@ void TableFormattingContext::compute_table_height(LayoutMode layout_mode)
span_width += m_columns[cell.column_index + i].used_width;
auto width_of_containing_block = m_state.get(*cell.box->containing_block()).content_width();
auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block);
auto height_of_containing_block = m_state.get(*cell.box->containing_block()).content_height();
auto height_of_containing_block_as_length = CSS::Length::make_px(height_of_containing_block);
cell_state.padding_top = cell.box->computed_values().padding().top().to_px(cell.box, width_of_containing_block);
cell_state.padding_bottom = cell.box->computed_values().padding().bottom().to_px(cell.box, width_of_containing_block);