Commit graph

15 commits

Author SHA1 Message Date
Aliaksandr Kalenik
b51c026f3d LibWeb: Don't layout flex descendants in intrinsic layout mode
We already have a check to skip the layout of descendants if the
available size is intrinsic, but this is not sufficient in nested
intrinsic layout cases, where the available size might be definite even
though we are in intrinsic layout mode.
2025-03-05 21:40:59 +01:00
Lukas Scheller
ce93088a81 LibWeb: Respect margin boxes when center-aligning flex items 2025-03-05 18:07:10 +01:00
Andreas Kling
fee0d408a1 LibWeb: Assume flex container forms containing block of abspos items
This avoids a dubious-looking UsedValues lookup.
2025-02-12 00:39:36 +01:00
Andreas Kling
d43cc82b1c LibWeb: Use cached UsedValues pointer in FlexFormattingContext more 2025-02-12 00:39:36 +01:00
Andreas Kling
bf15c7fa4b LibWeb: Remove "temporary content size" hack from flex layout
This was an old hack intended to make percentage sizes on flex items
before we had implemented the appropriate special behavior of definite
sizes in flex layout.

Removing it makes flex layout less magical and should not change
behavior in any observable way.
2025-02-11 14:23:13 +01:00
Andreas Kling
4cbd975b66 LibWeb: Simplify determination of flex item's hypothetical cross size
The spec tells us to treat `auto` as `fit-content` when determining
flex item cross sizes, so let's just do *that* instead of awkwardly
doing an uncacheable nested layout of the item.

This was the only instance of `LayoutState` nesting outside of intrinsic
sizing, so removing it is an important step towards simplifying layout.
Turns out it was a lot easier than expected.
2025-02-11 14:23:13 +01:00
Andreas Kling
0084d992d4 LibWeb: Remove unnecessary re-measurement of cross sizes in flex layout
This was an old hack from before we understood how and when to resolve
percentages in flex layout. Removing it should not change anything,
but it does avoid a lot of redundant layout work on many pages.
2025-02-10 01:26:34 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
aplefull
50445dc9ef LibWeb: Don't add extra gap when placing flex items in reverse order 2025-01-17 10:10:43 +01:00
Milo van der Tier
2ee7e555f2 LibWeb/CSS: Do not ignore self-start/self-end alignment in flex layout
This makes these values the same as `start` and `end`. While this is not
entirely correct, it is better than centering which is what we did
previously.

This fixes misaligned images on https://nos.nl
2024-12-03 00:17:53 +01:00
Psychpsyo
e2b2115722 LibWeb: Fix spec link in FlexFormattingContext 2024-11-23 01:37:32 +00:00
Andreas Kling
fbe9395928 LibWeb: Stop treating intrinsic size keywords as auto in CSS heights
This commit introduces proper handling of three intrinsic size keywords
when used for CSS heights:

- min-content
- max-content
- fit-content

This necessitated a few plumbing changes, since we can't resolve these
values without having access to containing block widths.

This fixes some visual glitches on https://www.supabase.com/ as well
as a number of WPT tests. It also improves the appearance of dialogs.
2024-11-21 19:21:51 +01:00
Aliaksandr Kalenik
a8c1d12e84 LibWeb: Fix percentage insets resolution for grid items
compute_inset() was incorrectly retrieving the containing block size
because containing_block() is unaware of grid areas that form a
containing block for grid items but do not exist in the layout tree.
With this change, we explicitly pass the containing block into
compute_inset(), allowing it to correctly provide the containing block
sizes for grid items.
2024-11-11 20:20:39 +01:00
Aliaksandr Kalenik
dd11d48a1d LibWeb: Use available space to resolve sizes in FFC
If available space is definite it should always match the size of the
containing block. Therefore, there is no need to do containing block
node lookup.
2024-11-10 19:14:54 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp (Browse further)