aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flexbox/layout.rs
Commit message (Collapse)AuthorAgeFilesLines
* layout: Combine `layout_2020` and `layout_thread_2020` into a crate called ↵Martin Robinson3 days1-2739/+0
| | | | | | | | | | | | | | | | | | `layout` (#36613) Now that legacy layout has been removed, the name `layout_2020` doesn't make much sense any longer, also it's 2025 now for better or worse. The split between the "layout thread" and "layout" also doesn't make as much sense since layout doesn't run on it's own thread. There's a possibility that it will in the future, but that should be something that the user of the crate controls rather than layout iself. This is part of the larger layout interface cleanup and optimization that @Looriool and I are doing. Testing: Covered by existing tests as this is just code movement. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Store `Fragment` results in `LayoutBoxBase` and start using them for ↵Martin Robinson4 days1-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | queries (#36583) Start storing a link to laid-out `Fragment`s in `LayoutBoxBase`, so that these are accessible for queries and eventually for incremental layout. Some box tree data structures lacked a `LayoutBoxBase`, such as table tracks and table track groups[^1]. In addition, start using these `Fragment`s for queries instead of walking the entire `Fragment` tree. Currently, this isn't possible for most queries as `Fragment`s do not cache their absolute offsets (which are often necessary). This change uses the new box tree `Fragment`s for most resolved style queries. [^1]: Note that only rows and row groups store `Fragment`s as columsn and colgroups do not produce any. Testing: This is covered by existing tests. Fixes: This is part of #36525. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Enforce min-content min main size of flex-level tables (#36469)Oriol Brufau10 days1-4/+10
| | | | | | | | | | | Additionally to the minimum specified in min-width or min-height, tables also enforce a `min-content` minimum. This was handled in `Sizes::resolve()`, but flex items don't use that. So this patch moves the logic into `Size::resolve_for_min()`. Testing: Covered by WPT Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Box `block_margins_collapsed_with_children` member of `BoxFragment` ↵Martin Robinson10 days1-4/+3
| | | | | | | | | | | (#36474) This reduces the size of `BoxFragment` by around 20 bytes. Testing: This just changes the layout of a data structure, so is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* refactor: use is_zero() instead of comparing with Au::Zero() (#36347)Barigbue Nbira12 days1-2/+2
| | | | | | | | | | | Use `is_zero()` instead of comparing with `Au::Zero()` for zero checks. Testing: This change does not cause behaviour change, a test is not necessary. Fixes: #36300 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
* layout: Enable using cached fragments when there is a BoxTree update point ↵Martin Robinson13 days1-2/+2
| | | | | | | | | | | | | | | | | | (#36404) This starts to enable the fragment cache for all layout modes, except grid. The main tricky bit here is that update points are absolutes and these need to be laid out again in their containing blocks. We punt a little bit on this, by forcing ancestors of update points to rebuild their Fragments. This is just the first step. Testing: We do not currently have layout performance tests, but will try to run some tests manually later. Behavior is covered by the WPT. Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Restrict stretch alignment to flex items with computed auto size ↵Oriol Brufau2025-04-041-62/+56
| | | | | | | | | | | | | | | | | | | | (#36288) We were allowing `align-self: stretch` to stretch flex items whose cross size behaves as `auto`, including cyclic percentages. However, https://github.com/w3c/csswg-drafts/issues/4525 resolved that stretching should only happen when the cross size computes to `auto`. So this patch exposes this information in `ContentBoxSizesAndPBM`, and refactors the flexbox stretching logic. Fixes: #36285 Testing: - `/css/css-flexbox/quirks-auto-block-size-with-percentage-item.html` - `/css/css-flexbox/stretch-requires-computed-auto-size.html` Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Ensure compatible positioning context during flexbox block content ↵Martin Robinson2025-03-251-5/+8
| | | | | | | | | | | | | | | sizing calculation (#36123) Sometimes column Flexbox needs to do an early layout pass to determine the preferred block content size of flex items. Previously the absolutely positioned children created during this pass were discarded, but now they are cached to be possibly used during the final layout phase of the flex item. Since they are not thrown away, it is necessary that the `PositioningContext` used to collect them is compatible with their final `PositioningContext`. Fixes #36121. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Cache `IndependentNonReplacedContents::layout()` (#36082)Oriol Brufau2025-03-241-57/+31
| | | | | | | | | | | | | | | This replaces `IndependentLayout` with `CacheableLayoutResult` and stores it in `LayoutBoxBase` so it can be reused when we need to lay out a box multiple times. This is a generalization of the caching that we had for flexbox, which is now removed in favor of the new one. With this, the number of runs per second in the Chromium perf test `flexbox-deeply-nested-column-flow.html` are multiplied by 3. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Implement the `fit-content()` sizing function (#36056)Oriol Brufau2025-03-231-5/+2
| | | | | | | | | | | | | | Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of https://github.com/w3c/csswg-drafts/issues/11805 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Obey sizing keywords in `layout_for_block_content_size()` (#36015)Oriol Brufau2025-03-191-83/+53
| | | | | | We were ignoring sizing keywords on the min and max sizing properties. With this, flexbox layout has full support for sizing keywords. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Support min/max main keyword sizes in flexbox (#35961)Oriol Brufau2025-03-191-283/+159
| | | | | | | | | | Adds support for min-content, max-content, fit-content and stretch on the min and max main size properties of a flex item. I'm removing `automatic_min_size()` and `flex_base_size()` because they would need to share so much code among themselves and their one caller that it's simpler to just inline the code. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Unify `FlexItem::new()` and `FlexItemBox::main_content_size_info()` ↵Oriol Brufau2025-03-141-243/+186
| | | | | | | | | (#35900) These methods were doing virtually the same thing. So this patch moves the common logic into a new `FlexItemBox::to_flex_item()`, which is then called by `FlexItem::new()` and `FlexItemBox::main_content_size_info()`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Allow lazy resolution of automatic minimum sizes (#35965)Oriol Brufau2025-03-131-3/+3
| | | | | | | | | | | `Size::resolve_for_min()` had an `Au` parameter, representing the value to be used for an automatic minimum size. However, this amount isn't trivial to compute in flexbox, so this patch changes the parameter to a function that can be called lazily. Note flexbox isn't currently using `Size::resolve_for_min()`, but it will in #35961. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Improve logic for establishing a stacking context (#35947)Oriol Brufau2025-03-131-1/+3
| | | | | | | | | | In particular: - `z-index` will now work on unpositioned grid items. - `will-change: z-index` will only establish a stacking context if `z-index` applies, i.e. if the box is positioned or a flex/grid item. - The conditions in `establishes_stacking_context()` are reordered, so that the most likely ones are checked first. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Remove `calculate_hypothetical_cross_size()` (#35821)Oriol Brufau2025-03-101-34/+23
| | | | | | | | | | One of the callers was only used for an assert, and it was passing an inline size argument to a parameter expecting a block size, so it wasn't making much sense anyways. Just inline the code into the other caller, and for consistency remove the assert for replaced elements too. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Support min/max cross keywords sizes in flexbox (#35860)Oriol Brufau2025-03-101-40/+79
| | | | | | | | Adds support for min-content, max-content, fit-content and stretch on the min and max cross size properties of a flex item. With one exception: when resolving the main sizes, transferred cross minimums and maximums will still ignore keywords. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Handle keyword sizes when computing the hypothetical cross size (#35826)Oriol Brufau2025-03-101-8/+14
| | | Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Assert that `hypothetical_cross_size` is already correct (#35816)Oriol Brufau2025-03-071-3/+8
| | | | | There doesn't seem to be a need to recompute it. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Partial support for keyword sizes on preferred cross size (#35682)Oriol Brufau2025-03-041-53/+69
| | | | | | | | | | | | | This changes `FlexItem::content_cross_size` into `Size<Au>` to preserve keyword sizes. The calculation of the hypothetical cross size still ignores them though, that will be addressed in a follow-up. Also, browsers don't follow the spec and treat a stretch size different than a stretch alignment: the former stretches to the containing block, while the latter stretches to the line. This aligns Servo with that behavior (following the spec would require bigger refactorings), so `stretches()` is renamed to `stretches_to_line()` for clarity. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-4/+4
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* layout: Merge `BoxFragment::used_overflow` into ↵Euclid Ye2025-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | `ComputedValuesExt::effective_overflow` (#35670) (#35670) * Update wpt-test * Merge used_overflow to effective_overflow; remove duplicate call * Remove more duplicate calls; update effective_overflow logic * Update reference link&style * Apply final review suggestions Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* layout: Use definite cross size to compute flex base size (#35688)Oriol Brufau2025-02-271-25/+23
| | | | | | | | An intrinsic flex base size depends on the contents, which may depend on the cross size through an aspect ratio. We were only taking this into account if the preferred cross size was numeric, but `auto` or `stretch` can also be definite. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Support `stretch` cross size for flex base size (#35663)Oriol Brufau2025-02-261-5/+7
| | | | | | | | The computation of the flex base size may involve transferring a definite cross size into the main axis through the aspect ratio. We were only considering numeric sizes as definite, but `stretch` can also be definite. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Support `stretch` cross size for automatic min size in flexbox (#35652)Oriol Brufau2025-02-261-5/+7
| | | | | | | | The computation of the automatic minimum size may involve transferring a definite cross size into the main axis through the aspect ratio. We were only considering numeric sizes as definite, but `stretch` can also be definite. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Change the `IndefiniteContainingBlock` sizes to `Option<Au>` (#35653)Oriol Brufau2025-02-251-4/+2
| | | | | Thus avoiding the need to convert to/from `AuOrAuto`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Let `automatic_min_size()` take a flex-relative cb size (#35642)Oriol Brufau2025-02-251-20/+14
| | | | | | | | | | This method was taking an `IndefiniteContainingBlock` parameter, and then it would first take the size corresponding to the main axis, and then the one for the cross axis. But it's simpler to just let it take a `FlexRelativeVec2<AuOrAuto>` parameter. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Update to rust 1.85 (#35628)Simon Wülker2025-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * Update to rust 1.85 This is needed for cargo-deny Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Upgrade crown Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Clippy fixes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Re-upgrade cargo-deny to 0.18 Keeping it locked to 0.18 just in case they update their required rustc version again Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* layout: Ignore indefinite `stretch` on min and max sizing properties (#35630)Oriol Brufau2025-02-241-24/+21
| | | | | | | | We were always treating an indefinite `stretch` as the automatic size. This instead treats it as `0px` on min sizing properties, and as `none` on max sizing properties, aligning with Blink and this recent CSSWG resolution: https://github.com/w3c/csswg-drafts/issues/11006 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Fully support sizing keywords on main size property of flex item ↵Oriol Brufau2025-02-171-56/+70
| | | | | | | | (#35471) Still lacking support on min and max main size properties, and on the various cross size properties. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Partial support for sizing keywords on flex items (#35469)Oriol Brufau2025-02-171-18/+22
| | | | | | | | | | | | | | | | | | * Add tests for sizing keywords on flex items Signed-off-by: Oriol Brufau <obrufau@igalia.com> * layout: Partial support for sizing keywords on flex items When a flex item has `flex-basis: auto`, the used `flex-basis` is the value of the main size property. In that case, if the main size property was set to keyword, we were always assuming it was `auto`. Now we handle non-`auto` keywords correctly. Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Basic implementation of size keywords on `flex-basis` (#35413)Oriol Brufau2025-02-131-130/+144
| | | | | | | | | | | layout: Basic implementation of size keywords on `flex-basis` This splits the logic to resolve the used value of `flex-basis` into its own method, which preserves size keywords. And then it changes `flex_base_size()` to resolve the provided keywords properly. However, it doesn't handle size keywords in the cross axis. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: align-content with default value normal should behave as strech in ↵TIN TUN AUNG2025-02-031-3/+8
| | | | | flex container (#35178) Signed-off-by: rayguo17 <rayguo17@gmail.com>
* layout: Remove min and max container sizes from `FlexContext` (#35144)Oriol Brufau2025-01-241-66/+45
| | | | | | | | | | | | | Thanks to #34946 we don't have to recompute the min and max sizes, we can get them from the `ContainingBlock`. And then in `FlexContext` there is no need to store both the definite and the min & max sizes of the container`, we can instead make do with a single `FlexRelativeVec2<SizeConstraint>`. This removes 1 of the 3 usages of `ContentBoxSizesAndPBMDeprecated`, which is also good. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Make naming of variables consistent with `SpecificLayoutInfo` (#35104)Martin Robinson2025-01-211-1/+1
| | | | | | | This is a followup to #34926. Fixes #35078. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Respect alignment when sizing replaced abspos (#35085)Oriol Brufau2025-01-201-28/+34
| | | | | | | If an absolutely position element which is replaced has `justify-self` or `align-self` set to `stretch`, and no inset is `auto` on that axis, then an automatic size should behave as `stretch`, not as `fit-content`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Allow layouts to customize their used style (#35012)Oriol Brufau2025-01-161-4/+13
| | | | | | | | | | | | | | | Some layouts like table need some style overrides. We were handling this in `ComputedValuesExt`, but it was messy, unreliable and too limited. For example, we were assuming that a style with `display: table` would belong to a table wrapper box or table grid box. However, certain HTML elements can ignore their `display` value and generate a different kind of box. I think we aren't doing that yet, but we will need this. Also, resolving the used border of a table needs layout information, which we don't have in `ComputedValuesExt`. This patch will allow to improve border collapsing in a follow-up. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Generalize `ContainingBlock`'s block size to a `SizeConstraint` (#34946)Oriol Brufau2025-01-131-18/+21
| | | | | | | | | | | | | It used to be an `AuOrAuto`, turning it into a `SizeConstraint` allows passing the information about the min and max constraints when the containing block doesn't have a definite block size. This will be useful for table layout. Note that in most cases we were already constructing the containing block from a `SizeConstraint`, but we were calling `to_auto_or()` to turn it into an `AuOrAuto`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Make `Fragment` hold `ArcRefCell` inside (#34923)Martin Robinson2025-01-131-1/+1
| | | | | | | | | | | | Push the interior mutability into enum variants of `Fragment`, so that they can be cloned. This saves memory in the `Fragment` tree as the `Fragment` enum is now a relatively wee 16 bytes and the interior parts can be a variety of sizes. Before, every `Fragment` was the size of the biggest kind (`BoxFragment` - 248 bytes). This a step on the way toward incremental layout. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: grid template getComputedStyle resolved value (#34885)Steven Novaryo2025-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Store taffy detailed info into fragment Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Fix info propagation and resolved grid track query Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Fix import Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Fix tracklist matching logic and type optimization Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Run fmt Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Update wpt expectations Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Optimizing info propagation and minor qol Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Run fmt Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Elide lifetimes where possible after rustup (#34824)Martin Robinson2025-01-031-1/+1
| | | | | | | | | The new version of rust allows us to elide some lifetimes and clippy is now complaining about this. This change elides them where possible and removes the clippy exceptions. Fixes #34804. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Refactor box size computation (#34671)Oriol Brufau2024-12-191-15/+29
| | | | | | | | | in each layout logic, in order to correctly resolve sizing keywords. This patch adds a new `Sizes` struct which holds the preferred, min and max sizing values for one axis, and unifies the logic to resolve the final size into there. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* script: Manage `<iframe>` sizes in `Window` (#34643)Martin Robinson2024-12-161-2/+5
| | | | | | | | Manage `<iframe>` size updates in `Window`. In addition to removing duplicated code, this will allow setting `<iframe>` sizes synchronously on child `Pipeline`s of the same origin in the script process in a followup change. The goal is remove flakiness from `<iframe>` sizing. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Distinguish cached `inline_content_sizes()` from uncached ones (#34595)Oriol Brufau2024-12-121-4/+8
| | | | | | | | | | | | | | Several structs and enums had a `inline_content_sizes()` method, but it wasn't clear which ones would try to cache the result, and which ones would always compute it. Therefore, this performs some clarifying renaming: - Cached ones stay as `inline_content_sizes()` - Uncached ones become `compute_inline_content_sizes()` Also, to simplify calls to `LayoutBoxBase::inline_content_sizes()`, `compute_inline_content_sizes()` is moved into a new trait. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Make sure to cache `inline_content_sizes()` (#34586)Oriol Brufau2024-12-121-1/+1
| | | | | | | | | | | | | | | | The refactoring in 264c0f972fd1a732ee1d1490d78a1d26a65c6f5f stopped caching the `inline_content_sizes()` calls from: - `FlexItemBox::layout_for_block_content_size()` - `IndependentFormattingContext::layout_float_or_atomic_inline()` - `TaffyContainerContext::compute_child_layout()` Also, the call from `OutsideMarker::layout()` was never cached. This patch caches all of them. It's not clear at all which `inline_content_sizes()` are cached and which aren't, so I plan to improve the situation in a follow-up. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Make a new `ContainingBlockSize` type (#34565)Martin Robinson2024-12-111-23/+30
| | | | | | | | This might make caching these values a bit easier in the future. Correcting the visibility of `ContainingBlock` also exposed some new rustc and clippy warnings that are fixed here. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Add `LayoutBoxBase` and use it for `IndependentFormattingContext` ↵Martin Robinson2024-12-071-38/+37
| | | | | | | | | | | | | | | | | | (#34507) Add a new struct `LayoutBoxBase`, that will be used throughout the box tree. The idea of this struct is that we have a place to consistently store common layout information (style and node information) and also to cache layout results such as content sizes (inline and maybe later box sizes) and eventually layout results. In addition to the addition of this struct, `IndependentFormattingContext` is flattened slightly so that it directly holds the contents of both replaced and non-replaced elements. This is only added to independent formatting contexts, but will later be added to all block containers as well. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Improve performance of flex column layouts by caching (#34461)Oriol Brufau2024-12-031-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Obey min and max properties when computing main size of column flex When laying out a column flex container with an auto preferred main size, we were resolving the used main size to the intrinsic max-content size. However, we weren't clamping this amount between the min and max sizes. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Improve performance of flex column layouts by caching We were already using a cache for layout_for_block_content_size(), but we were only storing the intrinsic block size. Thus when laying out the flex items for real, we would perform new layouts, triggering an exponential complexity in case of nested flexboxes. Now we cache the entire layout result so that we can avoid doing the work again. This improves the results of flexbox-deeply-nested-column-flow.html (a Blink perf test) from ~40 runs/second to ~500 runs/second on my PC. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Obey min and max properties when computing main size of column flex (#34450)Oriol Brufau2024-12-021-8/+9
| | | | | | | | When laying out a column flex container with an auto preferred main size, we were resolving the used main size to the intrinsic max-content size. However, we weren't clamping this amount between the min and max sizes. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Refactor computation of preferred aspect ratios (#34416)Oriol Brufau2024-11-291-45/+53
| | | | | | | | | | | | | | | | | | | * Refactor computation of preferred aspect ratios Computing min/max-content sizes required a ContainingBlock in order to resolve the padding and border when determining the preferred aspect ratio. However, all callers already knew the padding and border, so they can compute the ratio themselves, and pass it directly instead of the ContainingBlock. Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Put preferred aspect ratio into ConstraintSpace Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>