mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Deduplicate gap_to_px
This commit creates one common gap_to_px function. This resolves problem in the unity build.
This commit is contained in:
Notes:
github-actions[bot]
2026-04-09 14:06:27 +00:00
Author: https://github.com/R-Goc Commit: https://github.com/LadybirdBrowser/ladybird/commit/094e4bacf82 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8840 Reviewed-by: https://github.com/trflynn89
@@ -2426,25 +2426,18 @@ double FlexFormattingContext::FlexLine::sum_of_scaled_flex_shrink_factor_of_unfr
|
||||
return sum;
|
||||
}
|
||||
|
||||
static CSSPixels gap_to_px(Variant<CSS::LengthPercentage, CSS::NormalGap> const& gap, Layout::Node const& grid_container, CSSPixels reference_value)
|
||||
{
|
||||
return gap.visit(
|
||||
[](CSS::NormalGap) { return CSSPixels(0); },
|
||||
[&](auto const& gap) { return gap.to_px(grid_container, reference_value); });
|
||||
}
|
||||
|
||||
CSSPixels FlexFormattingContext::main_gap() const
|
||||
{
|
||||
auto const& computed_values = flex_container().computed_values();
|
||||
auto const& gap = is_row_layout() ? computed_values.column_gap() : computed_values.row_gap();
|
||||
return gap_to_px(gap, flex_container(), inner_main_size(m_flex_container_state));
|
||||
return gap_to_px(gap, inner_main_size(m_flex_container_state));
|
||||
}
|
||||
|
||||
CSSPixels FlexFormattingContext::cross_gap() const
|
||||
{
|
||||
auto const& computed_values = flex_container().computed_values();
|
||||
auto gap = is_row_layout() ? computed_values.row_gap() : computed_values.column_gap();
|
||||
return gap_to_px(gap, flex_container(), inner_cross_size(m_flex_container_state));
|
||||
return gap_to_px(gap, inner_cross_size(m_flex_container_state));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user