mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 13:09:41 +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
|
@ -261,9 +261,9 @@ Length ComputedProperties::length(PropertyID property_id) const
|
|||
return property(property_id).as_length().length();
|
||||
}
|
||||
|
||||
LengthBox ComputedProperties::length_box(PropertyID left_id, PropertyID top_id, PropertyID right_id, PropertyID bottom_id, Layout::NodeWithStyle const& layout_node, ClampNegativeLengths disallow_negative_lengths, Length const& default_value) const
|
||||
LengthBox ComputedProperties::length_box(PropertyID left_id, PropertyID top_id, PropertyID right_id, PropertyID bottom_id, Layout::NodeWithStyle const& layout_node, ClampNegativeLengths disallow_negative_lengths, LengthPercentageOrAuto const& default_value) const
|
||||
{
|
||||
auto length_box_side = [&](PropertyID id) -> LengthPercentage {
|
||||
auto length_box_side = [&](PropertyID id) -> LengthPercentageOrAuto {
|
||||
auto const& value = property(id);
|
||||
|
||||
if (value.is_calculated())
|
||||
|
@ -292,7 +292,7 @@ LengthBox ComputedProperties::length_box(PropertyID left_id, PropertyID top_id,
|
|||
}
|
||||
|
||||
if (value.has_auto())
|
||||
return LengthPercentage { Length::make_auto() };
|
||||
return LengthPercentageOrAuto::make_auto();
|
||||
|
||||
return default_value;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue