1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibWeb: Modernize handling of the CSS flex-basis property

Instead of a custom struct, use an AK::Variant for flex-basis.
A flex-basis is either `content` or a CSS size value, so we don't need
anything custom for that.

By using a CSS size, we also avoid having to convert in and out of size
in various places, simplifying the code.

This finally gets rid of the "Unsupported main size for flex-basis"
debug spam. :^)
This commit is contained in:
Andreas Kling 2023-06-21 19:39:07 +02:00
parent 8c980cf75b
commit 8648355783
6 changed files with 44 additions and 89 deletions

View file

@ -53,7 +53,7 @@ private:
struct FlexItem {
JS::NonnullGCPtr<Box> box;
CSS::FlexBasisData used_flex_basis {};
Optional<CSS::FlexBasis> used_flex_basis {};
bool used_flex_basis_is_definite { false };
CSSPixels flex_base_size { 0 };
CSSPixels hypothetical_main_size { 0 };
@ -214,7 +214,7 @@ private:
virtual void parent_context_did_dimension_child_root_box() override;
CSS::FlexBasisData used_flex_basis_for_item(FlexItem const&) const;
CSS::FlexBasis used_flex_basis_for_item(FlexItem const&) const;
LayoutState::UsedValues& m_flex_container_state;