mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +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:
parent
5eb0f65cc0
commit
0fb571c1c2
14 changed files with 154 additions and 75 deletions
|
@ -373,9 +373,7 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us
|
|||
if (size.calculated().contains_percentage()) {
|
||||
if (!containing_block_has_definite_size)
|
||||
return false;
|
||||
auto containing_block_size_as_length = width
|
||||
? CSS::Length::make_px(containing_block_used_values->content_width())
|
||||
: CSS::Length::make_px(containing_block_used_values->content_height());
|
||||
auto containing_block_size_as_length = width ? containing_block_used_values->content_width() : containing_block_used_values->content_height();
|
||||
resolved_definite_size = adjust_for_box_sizing(size.calculated().resolve_length_percentage(node, containing_block_size_as_length).value_or(CSS::Length::make_auto()).to_px(node), size, width);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue