1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibWeb: Rename the LayoutMode enum values and explain them

The old mode names, while mechanically accurate, didn't really reflect
their relationship to the CSS specifications.

This patch renames them as follows:

    Default => Normal
    AllPossibleLineBreaks => MinContent
    OnlyRequiredLineBreaks => MaxContent

There's also now an explainer comment with the LayoutMode enum about the
specific implications of layout in each mode.
This commit is contained in:
Andreas Kling 2022-03-19 15:44:02 +01:00
parent ceb055a75e
commit c1f0d21bbe
10 changed files with 43 additions and 32 deletions

View file

@ -112,7 +112,7 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode)
// AD-HOC: Layout the inside of all flex items.
copy_dimensions_from_flex_items_to_boxes();
for (auto& flex_item : m_flex_items) {
auto independent_formatting_context = layout_inside(flex_item.box, LayoutMode::Default);
auto independent_formatting_context = layout_inside(flex_item.box, LayoutMode::Normal);
independent_formatting_context->parent_context_did_dimension_child_root_box();
}
@ -451,7 +451,7 @@ float FlexFormattingContext::calculate_indefinite_main_size(FlexItem const& item
} else {
box_state.content_width = resolved_definite_cross_size(item.box);
}
independent_formatting_context->run(item.box, LayoutMode::Default);
independent_formatting_context->run(item.box, LayoutMode::Normal);
if (is_row_layout())
return box_state.content_width;
@ -477,7 +477,7 @@ float FlexFormattingContext::calculate_indefinite_main_size(FlexItem const& item
VERIFY(independent_formatting_context);
box_state.content_width = fit_content_cross_size;
independent_formatting_context->run(item.box, LayoutMode::Default);
independent_formatting_context->run(item.box, LayoutMode::Normal);
return BlockFormattingContext::compute_theoretical_height(throwaway_state, item.box);
}
@ -825,7 +825,7 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem&
} else {
box_state.content_height = resolved_definite_main_size(item.box);
}
independent_formatting_context->run(item.box, LayoutMode::Default);
independent_formatting_context->run(item.box, LayoutMode::Normal);
if (is_row_layout())
item.hypothetical_cross_size = BlockFormattingContext::compute_theoretical_height(throwaway_state, item.box);
@ -854,7 +854,7 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem&
VERIFY(independent_formatting_context);
box_state.content_width = fit_content_main_size;
independent_formatting_context->run(item.box, LayoutMode::Default);
independent_formatting_context->run(item.box, LayoutMode::Normal);
item.hypothetical_cross_size = BlockFormattingContext::compute_theoretical_height(throwaway_state, item.box);
}