1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +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

@ -21,9 +21,20 @@
namespace Web::Layout {
enum class LayoutMode {
Default,
AllPossibleLineBreaks,
OnlyRequiredLineBreaks,
// Normal layout.
// - We use the containing block's used width.
// - Content flows into the available space, line breaks inserted where necessary.
Normal,
// MinContent layout is used for discovering the min-content intrinsic size of a box.
// - We act as if the containing block has 0 used width.
// - Every line-breaking opportunity is taken.
MinContent,
// MaxContent layout is used for discovering the max-content intrinsic size of a box.
// - We act as if the containing block has infinite used width.
// - Only forced line-breaking opportunities are taken.
MaxContent,
};
class Node : public TreeNode<Node> {