mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
LibWeb: Skip flexible tracks expansion if there's no any of them [GFC]
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
We could skip calculating fr unit size if we know there's no flexible tracks.
This commit is contained in:
parent
7b1a97c109
commit
0ef61ad813
Notes:
github-actions[bot]
2025-08-31 17:14:18 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 0ef61ad813
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6036
2 changed files with 19 additions and 8 deletions
|
@ -707,6 +707,11 @@ void GridFormattingContext::initialize_track_sizes(GridDimension dimension)
|
|||
if (track.max_track_sizing_function.is_fixed(available_size)) {
|
||||
track.growth_limit = track.max_track_sizing_function.css_size().to_px(grid_container(), available_size.to_px_or_zero());
|
||||
} else if (track.max_track_sizing_function.is_flexible_length()) {
|
||||
if (dimension == GridDimension::Column) {
|
||||
m_has_flexible_column_tracks = true;
|
||||
} else {
|
||||
m_has_flexible_row_tracks = true;
|
||||
}
|
||||
track.growth_limit = {};
|
||||
} else if (track.max_track_sizing_function.is_intrinsic(available_size)) {
|
||||
track.growth_limit = {};
|
||||
|
@ -749,7 +754,9 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(GridDimension dimensio
|
|||
// 4. Increase sizes to accommodate spanning items crossing flexible tracks: Next, repeat the previous
|
||||
// step instead considering (together, rather than grouped by span size) all items that do span a
|
||||
// track with a flexible sizing function while
|
||||
increase_sizes_to_accommodate_spanning_items_crossing_flexible_tracks(dimension);
|
||||
if (has_flexible_tracks(dimension)) {
|
||||
increase_sizes_to_accommodate_spanning_items_crossing_flexible_tracks(dimension);
|
||||
}
|
||||
|
||||
// 5. If any track still has an infinite growth limit (because, for example, it had no items placed in
|
||||
// it or it is a flexible track), set its growth limit to its base size.
|
||||
|
@ -1058,12 +1065,6 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
|
|||
spanned_tracks.append(track);
|
||||
});
|
||||
|
||||
auto item_spans_tracks_with_flexible_sizing_function = any_of(spanned_tracks, [](auto& track) {
|
||||
return track.max_track_sizing_function.is_flexible_length();
|
||||
});
|
||||
if (!item_spans_tracks_with_flexible_sizing_function)
|
||||
continue;
|
||||
|
||||
// 1. For intrinsic minimums: First increase the base size of tracks with an intrinsic min track sizing
|
||||
// function by distributing extra space as needed to accommodate these items’ minimum contributions.
|
||||
auto item_size_contribution = [&] {
|
||||
|
@ -1343,7 +1344,9 @@ void GridFormattingContext::run_track_sizing(GridDimension dimension)
|
|||
maximize_tracks(dimension);
|
||||
|
||||
// 4. Expand Flexible Tracks
|
||||
expand_flexible_tracks(dimension);
|
||||
if (has_flexible_tracks(dimension)) {
|
||||
expand_flexible_tracks(dimension);
|
||||
}
|
||||
|
||||
// 5. Expand Stretched auto Tracks
|
||||
stretch_auto_tracks(dimension);
|
||||
|
|
|
@ -307,6 +307,14 @@ private:
|
|||
size_t m_explicit_rows_line_count { 0 };
|
||||
size_t m_explicit_columns_line_count { 0 };
|
||||
|
||||
bool m_has_flexible_row_tracks { false };
|
||||
bool m_has_flexible_column_tracks { false };
|
||||
|
||||
bool has_flexible_tracks(GridDimension dimension) const
|
||||
{
|
||||
return dimension == GridDimension::Column ? m_has_flexible_column_tracks : m_has_flexible_row_tracks;
|
||||
}
|
||||
|
||||
OccupationGrid m_occupation_grid;
|
||||
Vector<GridItem> m_grid_items;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue