mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWeb: Assign hypothetical flex item main sizes as temporary main size
This colors a bit outside the lines of the specification, but the spec doesn't offer a proper explanation for how descendants of a flex item are supposed to have access to the flex item's main size for purposes of percentage resolution. The approach I came up with here was to take the hypothetical main size of each flex item, and assign it as a temporary main size. This allows percentage resolution in descendants to work against the pre-flexing main size of items. This seems to match how other engines behave, although it feels somewhat dirty. If/when we learn more about this, we can come up with something nicer.
This commit is contained in:
@@ -301,6 +301,16 @@ void LayoutState::UsedValues::set_content_height(float height)
|
||||
m_has_definite_height = true;
|
||||
}
|
||||
|
||||
void LayoutState::UsedValues::set_temporary_content_width(float width)
|
||||
{
|
||||
m_content_width = width;
|
||||
}
|
||||
|
||||
void LayoutState::UsedValues::set_temporary_content_height(float height)
|
||||
{
|
||||
m_content_height = height;
|
||||
}
|
||||
|
||||
float LayoutState::resolved_definite_width(Box const& box) const
|
||||
{
|
||||
return get(box).content_width();
|
||||
|
||||
Reference in New Issue
Block a user