Commit Graph

11 Commits

Author SHA1 Message Date
Andreas Kling
5de6382d11 LibWeb: Fix flex abspos static positions on reversed cross axes
The static-position rectangle for absolutely positioned flex children
still mapped cross-axis flex-start and flex-end directly to physical
start and end. That broke cases where the flex cross axis is reversed
by writing mode, direction, or wrap-reverse.

Teach the flex formatting context to derive the cross-axis direction
from its logical axes and wrap mode, and use that when resolving
cross-axis alignment for abspos static positioning. This clears the
newly imported position-absolute-013 test and improves a broader set
of existing flex abspos WPT baselines.
2026-04-03 14:29:44 +02:00
Andreas Kling
0e41072db7 LibWeb: Fix remaining flex percentage-height WPTs
Handle flex main and cross axes in logical terms so percentage
height resolution keeps working in vertical writing modes and
other orthogonal cases. Also let resolvable percentage max
cross sizes clamp stretched flex items.

The same change improves a broader set of imported css-flexbox
tests than the original percentage-heights cases. Update the
affected expectations in the same change so the resulting
behavior stays documented and the suite remains green.
2026-04-03 14:29:44 +02:00
Jelle Raaijmakers
277512ce01 LibWeb: Implement CSS flexbox baseline aligned items 2026-03-24 05:13:49 +01:00
Andreas Kling
6894034774 LibWeb: Mark flex item main size definite if resolved from aspect-ratio
This matches the behavior of other engines and makes the cards on the
Apple App Store appear in the narrower layouts.
2025-11-07 16:42:32 +01:00
Jelle Raaijmakers
3741d3040c LibWeb: Support percentage values in min/max flex item size constraints
Originally, 7200b3a16c introduced a two-pass system to determine
hypothetical cross sizes. Later, this was partially reverted in
0084d992d4, but some code was left behind that caused resolution of
percentages in `{min/max}-{width/height}` size constraints not to work.

Through intrinsic sizing, we can potentially end up with a definite
available space for the items in the last FC run. At that point we
should be able to resolve percentages against the available space, but
we were never doing that.
2025-11-05 12:01:40 +01:00
Andreas Kling
6ec10a5408 LibWeb: Make more FlexFormattingContext functions take FlexItem
...instead of taking the Layout::Box. This will allow us to make more
nuanced decisions in those functions by having access to flex layout
internal state.
2025-09-29 13:27:58 +02:00
Andreas Kling
7b2a427430 LibWeb: Avoid computing automatic minimum size for some flex items
There's a specific (and thankfully very common!) scenario where we can
actually skip calculating the automatic minimum size for flex items.

In single-line (no wrapping) flex containers, if the sum of all item
flex base sizes is <= the flex container's main size, we know that
none of the items will be shrunk by the layout algorithm.

And so for any flex item with definite main size AND automatic minimum
main size, we can treat the automatic minimum size as 0.
2025-04-22 15:46:10 +02:00
Andreas Kling
d43cc82b1c LibWeb: Use cached UsedValues pointer in FlexFormattingContext more 2025-02-12 00:39:36 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +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