mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-27 21:42:53 +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:
parent
4bc38300ad
commit
05a1dbeb91
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 05a1dbeb91
Pull-request: https://github.com/SerenityOS/serenity/pull/22636
Reviewed-by: https://github.com/AtkinsSJ
6 changed files with 48 additions and 40 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue