summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/Node.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-19 15:44:02 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-19 15:46:15 +0100
commitc1f0d21bbefadaf2e8c9b295c74132c550d43e07 (patch)
treeb06c3f4d42b8837fe394c63536edc9e975d70193 /Userland/Libraries/LibWeb/Layout/Node.h
parentceb055a75e34580e7d66b69e7c92d27d3110e815 (diff)
downloadserenity-c1f0d21bbefadaf2e8c9b295c74132c550d43e07.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/Node.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 135e7b9434..7ace3399e7 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -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> {