mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Make solve_replaced_size_constraint() into FormattingContext
This commit is contained in:
parent
42470d837e
commit
4fed7beb7b
Notes:
sideshowbarker
2024-07-17 18:06:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4fed7beb7b Pull-request: https://github.com/SerenityOS/serenity/pull/19178
@ -256,12 +256,12 @@ FormattingContext::ShrinkToFitResult FormattingContext::calculate_shrink_to_fit_
|
||||
};
|
||||
}
|
||||
|
||||
static CSSPixelSize solve_replaced_size_constraint(LayoutState const& state, CSSPixels input_width, CSSPixels input_height, ReplacedBox const& box)
|
||||
CSSPixelSize FormattingContext::solve_replaced_size_constraint(CSSPixels input_width, CSSPixels input_height, ReplacedBox const& box) const
|
||||
{
|
||||
// 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
|
||||
|
||||
auto const& containing_block = *box.non_anyonymous_containing_block();
|
||||
auto const& containing_block_state = state.get(containing_block);
|
||||
auto const& containing_block_state = m_state.get(containing_block);
|
||||
auto width_of_containing_block = containing_block_state.content_width();
|
||||
auto height_of_containing_block = containing_block_state.content_height();
|
||||
|
||||
@ -446,7 +446,7 @@ CSSPixels FormattingContext::compute_width_for_replaced_element(ReplacedBox cons
|
||||
if (computed_width.is_auto() && computed_height.is_auto() && box.has_intrinsic_aspect_ratio()) {
|
||||
CSSPixels w = used_width;
|
||||
CSSPixels h = tentative_height_for_replaced_element(box, computed_height, available_space);
|
||||
used_width = solve_replaced_size_constraint(m_state, w, h, box).width();
|
||||
used_width = solve_replaced_size_constraint(w, h, box).width();
|
||||
return used_width;
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ CSSPixels FormattingContext::compute_height_for_replaced_element(ReplacedBox con
|
||||
if (computed_width.is_auto() && computed_height.is_auto() && box.has_intrinsic_aspect_ratio()) {
|
||||
CSSPixels w = tentative_width_for_replaced_element(box, computed_width, available_space);
|
||||
CSSPixels h = used_height;
|
||||
used_height = solve_replaced_size_constraint(m_state, w, h, box).height();
|
||||
used_height = solve_replaced_size_constraint(w, h, box).height();
|
||||
return used_height;
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,8 @@ protected:
|
||||
CSSPixels tentative_height_for_replaced_element(ReplacedBox const&, CSS::Size const& computed_height, AvailableSpace const&) const;
|
||||
CSSPixels compute_auto_height_for_block_formatting_context_root(Box const&) const;
|
||||
|
||||
[[nodiscard]] CSSPixelSize solve_replaced_size_constraint(CSSPixels input_width, CSSPixels input_height, ReplacedBox const&) const;
|
||||
|
||||
ShrinkToFitResult calculate_shrink_to_fit_widths(Box const&);
|
||||
|
||||
void layout_absolutely_positioned_element(Box const&, AvailableSpace const&);
|
||||
|
Loading…
Reference in New Issue
Block a user