servo/components/layout_2020
Oriol Brufau 0be5209003
Improve performance of flex column layouts by caching (#34461)
* 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>
2024-12-03 12:35:24 +00:00
..
display_list Use webrender_api::units::DevicePixel rather than style_traits::DevicePixel unless interfacing with Stylo (#34353) 2024-11-25 23:42:04 +00:00
flexbox Improve performance of flex column layouts by caching (#34461) 2024-12-03 12:35:24 +00:00
flow Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
fragment_tree Add BoxFragment::is_inline_box() (#34233) 2024-11-12 15:50:20 +00:00
table Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
taffy Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
tests layout: Right-to-left support for other layout modes (#33375) 2024-09-11 13:40:11 +00:00
Cargo.toml Remove some unused dependencies (#34355) 2024-11-25 10:29:58 +00:00
cell.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
construct_modern.rs Layout: Implement CSS Grid using taffy (#32619) 2024-11-21 20:21:01 +00:00
context.rs fonts: Simplify FontContext in two ways that affect the unit test (#33541) 2024-09-25 20:15:47 +00:00
dom.rs Layout: Implement CSS Grid using taffy (#32619) 2024-11-21 20:21:01 +00:00
dom_traversal.rs Replace .map_or(false with Option::is_some_and (#33468) 2024-09-16 10:03:52 +00:00
formatting_contexts.rs Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
geom.rs Use LazyCells instead of callbacks when resolving size keywords (#34211) 2024-11-11 16:26:20 +00:00
layout_debug.rs clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
lib.rs Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
lists.rs layout: Add a basic support for list-style-position: outside (#32114) 2024-04-22 14:23:35 +00:00
positioned.rs Refactor AbsoluteAxisSolver (#34443) 2024-12-02 12:49:00 +00:00
query.rs Fix offsetLeft/offsetTop to match major browsers (#32761) 2024-11-16 15:28:38 +00:00
replaced.rs Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
sizing.rs Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
style_ext.rs Refactor computation of preferred aspect ratios (#34416) 2024-11-29 11:40:52 +00:00
traversal.rs script: Split style and layout data in DOM nodes (#31985) 2024-04-04 07:56:51 +00:00