mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-21 07:29:53 +00:00
LibWeb: Make LengthBox hold LengthPercentageOrAuto
Not every user of this requires an `auto` state, but most do. This has quite a big diff but most of that is mechanical: LengthPercentageOrAuto has `resolved_or_auto()` instead of `resolved()`, and `to_px_or_zero()` instead of `to_px()`, to make their output clearer.
This commit is contained in:
parent
70609cbf4d
commit
dd122e2f74
Notes:
github-actions[bot]
2025-09-04 12:32:43 +00:00
Author: https://github.com/AtkinsSJ
Commit: dd122e2f74
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6043
17 changed files with 199 additions and 215 deletions
|
@ -458,14 +458,13 @@ void LayoutState::commit(Box& root)
|
|||
scrollport_size = nearest_scrollable_ancestor->absolute_rect().size();
|
||||
|
||||
if (!inset.top().is_auto())
|
||||
sticky_insets->top = inset.top().to_px(node, scrollport_size.height());
|
||||
sticky_insets->top = inset.top().to_px_or_zero(node, scrollport_size.height());
|
||||
if (!inset.right().is_auto())
|
||||
sticky_insets->right = inset.right().to_px(node, scrollport_size.width());
|
||||
sticky_insets->right = inset.right().to_px_or_zero(node, scrollport_size.width());
|
||||
if (!inset.bottom().is_auto())
|
||||
sticky_insets->bottom = inset.bottom().to_px(node, scrollport_size.height());
|
||||
sticky_insets->bottom = inset.bottom().to_px_or_zero(node, scrollport_size.height());
|
||||
if (!inset.left().is_auto())
|
||||
sticky_insets->left = inset.left().to_px(node, scrollport_size.width());
|
||||
|
||||
sticky_insets->left = inset.left().to_px_or_zero(node, scrollport_size.width());
|
||||
paintable_box->set_sticky_insets(move(sticky_insets));
|
||||
}
|
||||
}
|
||||
|
@ -498,14 +497,14 @@ void LayoutState::UsedValues::set_node(NodeWithStyle const& node, UsedValues con
|
|||
|
||||
if (width) {
|
||||
border_and_padding = computed_values.border_left().width
|
||||
+ computed_values.padding().left().to_px(*m_node, containing_block_used_values->content_width())
|
||||
+ computed_values.padding().left().to_px_or_zero(*m_node, containing_block_used_values->content_width())
|
||||
+ computed_values.border_right().width
|
||||
+ computed_values.padding().right().to_px(*m_node, containing_block_used_values->content_width());
|
||||
+ computed_values.padding().right().to_px_or_zero(*m_node, containing_block_used_values->content_width());
|
||||
} else {
|
||||
border_and_padding = computed_values.border_top().width
|
||||
+ computed_values.padding().top().to_px(*m_node, containing_block_used_values->content_width())
|
||||
+ computed_values.padding().top().to_px_or_zero(*m_node, containing_block_used_values->content_width())
|
||||
+ computed_values.border_bottom().width
|
||||
+ computed_values.padding().bottom().to_px(*m_node, containing_block_used_values->content_width());
|
||||
+ computed_values.padding().bottom().to_px_or_zero(*m_node, containing_block_used_values->content_width());
|
||||
}
|
||||
|
||||
return unadjusted_pixels - border_and_padding;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue