1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +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

@ -81,9 +81,9 @@ void TableFormattingContext::calculate_column_widths(Box const& row, Vector<floa
auto& cell_state = m_state.get_mutable(cell);
compute_width(cell);
if (use_auto_layout) {
(void)layout_inside(cell, LayoutMode::OnlyRequiredLineBreaks);
(void)layout_inside(cell, LayoutMode::MaxContent);
} else {
(void)layout_inside(cell, LayoutMode::Default);
(void)layout_inside(cell, LayoutMode::Normal);
}
column_widths[column_index] = max(column_widths[column_index], cell_state.content_width);
column_index += cell.colspan();
@ -105,9 +105,9 @@ void TableFormattingContext::layout_row(Box const& row, Vector<float>& column_wi
// Layout the cell contents a second time, now that we know its final width.
if (use_auto_layout) {
(void)layout_inside(cell, LayoutMode::OnlyRequiredLineBreaks);
(void)layout_inside(cell, LayoutMode::MaxContent);
} else {
(void)layout_inside(cell, LayoutMode::Default);
(void)layout_inside(cell, LayoutMode::Normal);
}
BlockFormattingContext::compute_height(cell, m_state);