mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +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:
parent
ceb055a75e
commit
c1f0d21bbe
10 changed files with 43 additions and 32 deletions
|
@ -224,13 +224,13 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Layo
|
|||
float width_of_containing_block = 0;
|
||||
|
||||
switch (layout_mode) {
|
||||
case LayoutMode::Default:
|
||||
case LayoutMode::Normal:
|
||||
width_of_containing_block = m_state.get(containing_block).content_width;
|
||||
break;
|
||||
case LayoutMode::AllPossibleLineBreaks:
|
||||
case LayoutMode::MinContent:
|
||||
width_of_containing_block = 0;
|
||||
break;
|
||||
case LayoutMode::OnlyRequiredLineBreaks:
|
||||
case LayoutMode::MaxContent:
|
||||
width_of_containing_block = INFINITY;
|
||||
break;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
if (layout_mode != LayoutMode::Default) {
|
||||
if (layout_mode != LayoutMode::Normal) {
|
||||
auto& width = block_container.computed_values().width();
|
||||
if (!width.has_value() || (width->is_length() && width->length().is_auto())) {
|
||||
auto& block_container_state = m_state.get_mutable(block_container);
|
||||
|
@ -559,13 +559,13 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer
|
|||
float width_of_containing_block = 0;
|
||||
|
||||
switch (layout_mode) {
|
||||
case LayoutMode::Default:
|
||||
case LayoutMode::Normal:
|
||||
width_of_containing_block = m_state.get(containing_block).content_width;
|
||||
break;
|
||||
case LayoutMode::AllPossibleLineBreaks:
|
||||
case LayoutMode::MinContent:
|
||||
width_of_containing_block = 0;
|
||||
break;
|
||||
case LayoutMode::OnlyRequiredLineBreaks:
|
||||
case LayoutMode::MaxContent:
|
||||
width_of_containing_block = INFINITY;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue