mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Return CSSPixels from calculate_inner_width()
Initially, this function was made to return CSS::Length because some of its callers were expecting it to ignore "auto" width on input and return it as is. Instead, let's just forbid using "auto" for input width and always return CSSPixels.
This commit is contained in:
committed by
Andreas Kling
parent
4bc38300ad
commit
05a1dbeb91
@@ -154,19 +154,19 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l
|
||||
// NOTE: We can't resolve percentages yet. We'll have to wait until after inner layout.
|
||||
} else {
|
||||
auto inner_width = calculate_inner_width(box, m_available_space->width, width_value);
|
||||
unconstrained_width = inner_width.to_px(box);
|
||||
unconstrained_width = inner_width;
|
||||
}
|
||||
}
|
||||
|
||||
CSSPixels width = unconstrained_width;
|
||||
if (!should_treat_max_width_as_none(box, m_available_space->width)) {
|
||||
auto max_width = calculate_inner_width(box, m_available_space->width, box.computed_values().max_width()).to_px(box);
|
||||
auto max_width = calculate_inner_width(box, m_available_space->width, box.computed_values().max_width());
|
||||
width = min(width, max_width);
|
||||
}
|
||||
|
||||
auto computed_min_width = box.computed_values().min_width();
|
||||
if (!computed_min_width.is_auto()) {
|
||||
auto min_width = calculate_inner_width(box, m_available_space->width, computed_min_width).to_px(box);
|
||||
auto min_width = calculate_inner_width(box, m_available_space->width, computed_min_width);
|
||||
width = max(width, min_width);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user