mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-27 10:29:23 +00:00
LibWeb: Use correct width for flex item intrinsic height calculation
Some checks are pending
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / macOS, arm64, Sanitizer, 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 / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / macOS, arm64, Sanitizer, 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
Before this change, we always used the flex container's full available space as the width for intrinsic (height) sizing of flex items. This meant that flex lines with more than one flex item had their intrinsic height determined as if they were alone on the line. For flex row layouts, if we've already determined the flex item's main size, we now use that as the width to get the intrinsic height. This leads to more correct layouts, and also avoids some redundant work since we no longer do unnecessary sizing work with the wrong width (and can hit cache instead).
This commit is contained in:
parent
6ec10a5408
commit
7867fef8d7
Notes:
github-actions[bot]
2025-09-29 11:29:09 +00:00
Author: https://github.com/awesomekling
Commit: 7867fef8d7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6341
Reviewed-by: https://github.com/gmta ✅
3 changed files with 47 additions and 0 deletions
|
|
@ -22,6 +22,14 @@ CSSPixels FlexFormattingContext::get_pixel_width(FlexItem const& item, CSS::Size
|
|||
|
||||
CSSPixels FlexFormattingContext::get_pixel_height(FlexItem const& item, CSS::Size const& size) const
|
||||
{
|
||||
if (is_row_layout()) {
|
||||
// NOTE: In a row layout, after we've determined the main size, we use that as the available width
|
||||
// for any intrinsic sizing layout needed to resolve the height.
|
||||
auto available_width = item.main_size.has_value() ? AvailableSize::make_definite(item.main_size.value()) : AvailableSize::make_indefinite();
|
||||
auto available_height = AvailableSize::make_indefinite();
|
||||
auto available_space = AvailableSpace { available_width, available_height };
|
||||
return calculate_inner_height(item.box, available_space, size);
|
||||
}
|
||||
return calculate_inner_height(item.box, m_available_space.value(), size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue