mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibWeb: Make non-finite CSS lengths resolve to "auto"
When we're performing max-content layout (a separate throwaway layout pass that only exists to discover the intrinsic max-content size of a specific box), we act as if the containing block has infinite width. This allows an infinite length to propagate into the layout system, which is fine, but at some point it needs to be turned into a finite number or some loop conditions will not make sense and we can hang indefinitely (e.g in the flexible lengths resolution algorithm.) We fix this by making Length::resolved() turn non-finite values into an "auto" length.
This commit is contained in:
parent
b3deec061e
commit
e7370443f2
1 changed files with 2 additions and 0 deletions
|
@ -64,6 +64,8 @@ Length Length::resolved(Layout::Node const& layout_node) const
|
|||
return m_calculated_style->resolve_length(layout_node).release_value();
|
||||
if (is_relative())
|
||||
return make_px(to_px(layout_node));
|
||||
if (!isfinite(m_value))
|
||||
return make_auto();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue