1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:07:36 +00:00

LibWeb: Improve how layout nodes decide whether they have definite sizes

1. Make this decision *after* we've inserted the layout node into the
   layout tree. Otherwise, we can't reach its containing block!
2. Per css-sizing-3, consider auto-sized blocks whose sizes resolve
   solely against other definite sizes as definite themselves.

In particular, (2) makes us consider width:auto block children of a
definite-size containing block as having definite size. This becomes
very important in flex layout.
This commit is contained in:
Andreas Kling 2022-03-12 13:24:58 +01:00
parent d201378750
commit 12ac6861e3
3 changed files with 47 additions and 25 deletions

View file

@ -164,6 +164,8 @@ public:
void set_has_definite_height(bool b) { m_has_definite_height = b; }
void set_has_definite_width(bool b) { m_has_definite_width = b; }
void did_insert_into_layout_tree(CSS::StyleProperties const&);
protected:
NodeWithStyle(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
NodeWithStyle(DOM::Document&, DOM::Node*, CSS::ComputedValues);