mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +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
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 0fb571c1c2
Pull-request: https://github.com/SerenityOS/serenity/pull/20839
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/awesomekling
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